Continuous Loop
fzeitgeist
Posts: 20
Hi Everyone. I am trying to run a continuous loop unless some one presses a key on a keypad.
Lets say I am moving a motor for 49 seconds. If someone presses a key within those 49 secs. the motor stops, otherwise it should go to a different subroutine after completing the 49 secs. cycle.
I tried using the SERIN command with {Timeout,Tlabel,} syntax but it does'nt seem to work.
Here is what I have
wait_for_key:
SERIN Rx, Baud, 49000, continue , [noparse][[/noparse]temp]
return
'' 49000 seconds = Timeout
'' continue == go to this subroutine if no key pressed
Lets say I am moving a motor for 49 seconds. If someone presses a key within those 49 secs. the motor stops, otherwise it should go to a different subroutine after completing the 49 secs. cycle.
I tried using the SERIN command with {Timeout,Tlabel,} syntax but it does'nt seem to work.
Here is what I have
wait_for_key:
SERIN Rx, Baud, 49000, continue , [noparse][[/noparse]temp]
return
'' 49000 seconds = Timeout
'' continue == go to this subroutine if no key pressed
Comments
HIGH 0········· 'turns motor on
for x = 1 to 98
pause 500
IF·in1 = 0·THEN quit
next
GOTO next task
quit:
LOW 0
'do something else
The for/next loop will run the motor for 49 seconds - 98 x 500.
If Pin 1 is taken low the motor stops.· Resonse to the LOW pin 1 will be .5 seconds.· If that is not quick enough change the for/next loop to 196/250.· Then it will respond in .25 seconds.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
NEW! 4 MB EEPROM
http://hometown.aol.com/newzed/page4.html
·