Hello there,
I have a PIC18F24J50 and I want to set pin 0 of port A to digital pin inorder to have a push button turn an led on and off.
I have a C code that is working and sets pin 0 of port B to digital using
Code:
ANCON1bits.PCFG12 = 1;
All the C code:
Code:
void main(void) {
ANCON1bits.PCFG12 = 1; //RB0
TRISB=1;
TRISC=0;
RC0=0;
do
{
if(RB0 == 0)
{
__delay_ms(10);
if(RB0 == 0)
{
RC0 = 1;
__delay_ms(10);
RC0 = 0;
}
}
}while(1);
}
I am trying to do the same but I get error regarding PCFG12 that it doesn't exist!
All basic code:
Code:
PCFG12=1
TRISC.0 = 0
TRISB = 001111
button1 VAR PORTB.0
LED VAR PORTC.0
PortB = 0
mainloop:
If button1 = 0 Then
Low LED
Pause 600
Else
High LED
Pause 600
Endif
Goto mainloop
I appreciate if you help me get i working in Basic! Thanks
Bookmarks