18f25K22

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
be80be
Registered User
Registered User
Posts: 90
Joined: Mon Feb 23, 2009 2:15 am
Location: tn

18f25K22

Post by be80be » Sun Apr 30, 2017 4:04 pm

How do you get pins to be digital Im having a problem with maybe PORTC.2 or PORTA.6

I have a 8x8 leds on porta rows and portc cols I was testing some code and I can turn off all the leds but when I toggle just one led the led at portc.2 and porta.6
comes on while the led i toggle is off

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: 18f25K22

Post by Jerry Messina » Sun Apr 30, 2017 10:12 pm

Try SetAllDigital() in the updated module http://www.sfcompiler.co.uk/wiki/pmwiki ... tDigitalIO

If that doesn't fix the problem it may be a RMW issue. In that case read the LAT instead of the PORT register.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: 18f25K22

Post by Jerry Messina » Sun Apr 30, 2017 11:08 pm

... or it might be the slew rate control.

The K22 defaults to slow mode which is about 1/10 the normal speed. This can make RMW effects even worse than normal.
The newer versions of SetDigitalIO take care of this for you too.

be80be
Registered User
Registered User
Posts: 90
Joined: Mon Feb 23, 2009 2:15 am
Location: tn

Re: 18f25K22

Post by be80be » Sun Apr 30, 2017 11:52 pm

I got it figured out I used the LATC and wrote a whole port that fixed it

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: 18f25K22

Post by Jerry Messina » Mon May 01, 2017 12:17 pm

If using the LAT fixed it then it's pretty much likely a RMW problem (you should be able to set/clear individual bits in the LAT without worrying about RMW).

If you're not using the latest version of SetAllDigital you could also try adding

Code: Select all

SLRCON = 0
which should set the pins to normal slew rate. If you leave SLRCON set to its default the port pins are really slow to transition and that makes it worse.

Post Reply