Vizier87
Active Member
Hi guys,
I've been trying to program an input pin for a relatively new PIC for me: PIC16F1455. Normally in my case IF a direct TRIS register assignment did not work for an I/O, I'd go around the peripherals and disable them all and it has pretty much worked for me all this while.
But not with this new fella.
The datasheet has given associated functions such as follows:
What I'm trying to do is to just set RC4 as an input. Here's the code (MikroC):
I've tried disabling many others like
CM1CON0, CM1CON1, CM2CON0, CM2CON1 and all associated registers/bits but it didn't work.
The current code always turn the indicator LED high, although a direct check on the RC4 pin registers close to 0V.
Anything else I might be missing here?
By the way, an output pin works just ok. I can toggle all the PORTC pins pretty well.
Thanks,
Vizier87
I've been trying to program an input pin for a relatively new PIC for me: PIC16F1455. Normally in my case IF a direct TRIS register assignment did not work for an I/O, I'd go around the peripherals and disable them all and it has pretty much worked for me all this while.
But not with this new fella.
The datasheet has given associated functions such as follows:
What I'm trying to do is to just set RC4 as an input. Here's the code (MikroC):
C:
void main() {
/////////////////////////////////////////////////////////
// Configuration for this to work: Do not overwrite! ///
/////////////////////////////////////////////////////////
OSCCON = 0b00111110;
OSCTUNE = 3;
trisa = 0;
porta = 0;
UCON=0;
LATA=0;
ANSELA=0;
TRISA=0;
LATC=0;
ANSELC=0;
trisc0_bit = 0;
trisc1_bit = 0;
trisc2_bit = 0;
trisc3_bit = 0;
trisc4_bit = 1;
trisc5_bit = 0;
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
while(1){
if (trisc4_bit == 1){
Indicator = 1;
}
else Indicator = 0;
}
}
I've tried disabling many others like
CM1CON0, CM1CON1, CM2CON0, CM2CON1 and all associated registers/bits but it didn't work.
The current code always turn the indicator LED high, although a direct check on the RC4 pin registers close to 0V.
Anything else I might be missing here?
By the way, an output pin works just ok. I can toggle all the PORTC pins pretty well.
Thanks,
Vizier87