I'm using this PIC and for some reason I can output to RA0,RA1 etc. I cannot read from them though like this:
Code:
RA0=~RA0;
I have to do:
Code:
LATB0=~LATB0;
Which is obviously the last written bit...
Even with TRISA=0xFF, The input doesn't change, Even with debugging on I can't get an input, I can tell because the LED doesn't turn on when I hit the switch, and the variable doesn't change in the PIC.
It is completely unrelated to the compiler. ADCON1 (bits PCFG3:0) control whether AN0 to AN12 are analogue or digital. There are two possible reset values depending on a configuration word, this is all explained in the datasheet.
You will notice from page 13 that RA0 shares the pin with AN0. When the chip starts this pin will always be analogue. You need to set ADCON1 accordingly to set the pins to digital. Read page 260, set the bits correctly and see if that works.