Page 1 of 1

18f25K22

Posted: Sun Apr 30, 2017 4:04 pm
by be80be
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

Re: 18f25K22

Posted: Sun Apr 30, 2017 10:12 pm
by Jerry Messina
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.

Re: 18f25K22

Posted: Sun Apr 30, 2017 11:08 pm
by Jerry Messina
... 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.

Re: 18f25K22

Posted: Sun Apr 30, 2017 11:52 pm
by be80be
I got it figured out I used the LATC and wrote a whole port that fixed it

Re: 18f25K22

Posted: Mon May 01, 2017 12:17 pm
by Jerry Messina
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.