Last day i tried to program Microchip PIC midrange controller. To be precise the controller i used was PIC 18F25K80. I was using the C18 compiler. I was unable to drive the PORT C pins as digital, after googling for some time i found out the solution.
I tried setting the TRISbits,PORTbits and LATbits but was of no use
TRISCbits.TRISC1 = 0;/* Port C pin 1 configured for output */ PORTCbits.RC1 = 1; LATCbits.LATC1 = 1;
The answer was that Port C pins 0 and 1 are also used as the input and output to the secondary oscillator.The secondary oscillator had to be set for digital output setting the configuration bits using the #pragma directive
#pragma config SOSCSEL=DIG
By adding this the pin turned digital and blinked
Happy Hacking 🙂