Unfortunately, there is no way you can know when the key has stopped. So, you have 2 alternatives
1 - Let each command run for a small fraction of time before going back to prog
example
Code:
FRT:
HIGH 4
HIGH 6
pause 100
LOW 4
LOW 6
GOTO PROG
2 - Put a timeout. So, if Serin does not give you a character, turn off all outputs
SERIN PORTA.0,T9600, 1000, Timeout, RX
Timeout:
Code:
LOW 4
LOW 5
LOW 6
LOW 7
goto PROG
This is from the manual
An optional Timeoutand Labelmay be included to allow the program
to continue if a character is not received within acertain amount of time.
Timeoutis specified in 1 millisecond units. If the serial input pin stays in
the idle state during the Timeouttime, the program will exit the SERIN
command and jump to Label
Bookmarks