Code is working the way it is written. Your IF THEN loops basicly check to see if logic 0 is detected, if so it checks the next switch and if good continues . . . , it then executes a GOTO main and never goes to the next subroutine. it goes to the subroutine Continue if the if then is false, which as shown is an empty subroutine. The MAIN loop reinitializes the LEDs as off and sets the internal registers as logic high.
I think you only want to execute the code listed as main at startup. I would use gosub to execute the subroutines and return in the subroutine to cause the code to RETURN to the place just after it was sent there. something like:<p>
' code initialization
led1 = 0 'Turn LED1 off
led2 = 0 'Turn LED2 off
led3 = 0 'Turn LED3 off
led4 = 0 'Turn LED4 off
pswitch1 = 1 'Define switch1 as not pressed
pswitch2 = 1 'Define switch2 as not pressed
pswitch3 = 1 'Define switch3 as not pressed
pswitch4 = 1 'Define switch4 as not pressed
' here is your main loop
main:
gosub nothing ' check this sub routine and then gosub to the next sub r...
gosub LEDtwo ' this is the next thing loop will check
gosub LEDfour ' and then it will heck here
goto main ' now the loop repeats
nothing:
BLA BLA BLA
return
LEDtwo:
MORE BLA BLA
return
YAGETTHEIDEA:
bla bla
return
end
HTH
JS
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks