Electronic – PIC 24F output port not clearable

cembeddedpicport

I am working on a VGA driver for a PIC 24F microcontroller. I have set all B and C ports for OUTPUT with TRISB = 0 and TRISC = 0. After scoping I noticed that one of my pins always stays high after it is set only once, while the other pins react correctly.

More specific, PORTCbits.RC3 = 0 and PORTCbits.RC3 = 1 works perfectly fine, PORTCbits.RC4 = 1 works but stays high after the first toggle, and PORTCbits.RC4 = 0 does nothing.

The processor I am using is a PIC 24FJ64GA004, if this is relevant. All ports are configured in the same way via the tris registers and cleared beforehand.

Sorry if this question is not general enough, this is my first time asking something on this site.

Best Answer

I'd recommend that you check the datasheet and see if there are any errata associated with that particular micro.

From what I know (in the past), the case used to be where I would have to read/modify/write and then (in some cases) write twice to a port to ensure that it took.

Aside from that, can you isolate the port to ensure that nothing else is influencing that port pin? If you have a development board with NOTHING connected to that port, it might be worth a try to run the code there and see whether or not it is externally influenced or not.

Related Topic