Could someone please enlighten me as to why this doesn't work on a PIC16F688?
DEFINE OSC 4
led1 var porta.2
led2 var portc.2
onoff var word
sig var word
p0 var word
trisa.2 = 0
trisc.2 = 0
trisc.3 = 1
trisa.0 = 1
ADCON0 = 1
main:
onoff = portc.3
If onoff = 1 then <----Hangup is here
high led1
ADCIN 0,p0
sig = p0*4
pause(sig)
high led2
pause(sig)
low led2
else
low led1
low led2
endif
goto main
If I write it unconditional, it works beautifully. As soon as I try to tell it "only if C.3 is high" nothin...
If I tell it "only if C.3 = 0"... works fine.
I've also tried
if (PORTC.3 = 1) THEN
and
if PORTC.3 = 1 THEN
and
onoff = PORTC.3
if onoff = 1 then
and
if (onoff = 1) then
According to everything I have found online, any of these should work. I'm apparently missing something.....
Bookmarks