You're 99% of the way there... here's an amendment that should get you all the way...
Led Var PORTC.1
Sensor var PORTC.2
TRISC=%00000100
high Led
pause 5000
low led
loop:
if sensor = 1 then
high led
else
low led
endif
goto loop
end
You're 99% of the way there... here's an amendment that should get you all the way...
Led Var PORTC.1
Sensor var PORTC.2
TRISC=%00000100
high Led
pause 5000
low led
loop:
if sensor = 1 then
high led
else
low led
endif
goto loop
end
On the PIC16F688 RC1 & RC2 (and others - see datasheet) are A/D inputs by
default on power-up. Add this to the first section of your code;
ANSEL = 0
That will allow use of these pins as digital.
Bookmarks