I have a very simple test loop that only partly functions and I cannot figure out why.
main:
if PortB.0 = 0 then
if PortB.1 = 1 then
if PortB.4 = 1 then
runtime = 60
endif
endif
endif
if PortB.0 = 1 then
if PortB.1 = 1 then
if PortB.4 = 1 then
runtime = 90
endif
endif
endif
if PortB.0 = 1 then
if PortB.1 = 0 then
if PortB.4 = 0 then
runtime = 120
endif
endif
endif
pause 1
write 0, runtime.highbyte
write 1, runtime.lowbyte
if SSW = 1 then
redport = 1
pause 200
redport = 0
pause 200
goto main
endif
if SSW = 0 then
redport = 1
goto main1
endif
ended = 0
goto main
main1:
redport = 0
blueport = 1
pause 500
redport = 0
blueport = 0
goto main1
The problem is that this portion of code..
if SSW = 0 then
redport = 1
goto main1
endif
It does turn on the LED at redport, and keeps it on while SSW = 0 but does not jump to main1, and I have no idea why.
If SSW remains at 1 it sits in its loop and flashes the LED perfectly and detects the change to 0 every time. I'm baffled by this!
Bookmarks