Hi all,
i wrote a very simple code but it did not work
i want to turn on a led if the switch is on
this is the code:
TRISA = $ff
TRISB = 0
CMCON=7
main: if PORTA.1=1 THEN
PORTB.1=1
delay_ms (1000)
ELSE PORTB.1=0
END IF
GOTO MAIN
end.
and it did not work, i put the input on portb.b instead of the porta.1, it worked but i need to use the port A as input .
i think my problem is that i did not specify that i need the portA to be digital and not analog? is that right ?
if yes, how ?
please help
i wrote a very simple code but it did not work
i want to turn on a led if the switch is on
this is the code:
TRISA = $ff
TRISB = 0
CMCON=7
main: if PORTA.1=1 THEN
PORTB.1=1
delay_ms (1000)
ELSE PORTB.1=0
END IF
GOTO MAIN
end.
and it did not work, i put the input on portb.b instead of the porta.1, it worked but i need to use the port A as input .
i think my problem is that i did not specify that i need the portA to be digital and not analog? is that right ?
if yes, how ?
please help
Last edited: