Timeout from a subroutine getchar to main is wrong.
You should do it like this:
Code:
getChar
'Receive a character, if no character within 100ms, then goto main
hserin 100, exit_getchar, [flag]
pause 100
hserout ["received a character", 13]
' if char[0] = "U" then
' HSerout ["received a 'U'", 13]
'Receive the remainder of the message
' hserin [STR char[1]\9]
' hserout ["received 9 more characters",13]
' hserout [str char\10]
'array char[] should now hold all 10 bytes of the message from Elo
' endif
exit_getchar:
return
Of course this will not start over from main, but if you need this, then set a flag in the subroutine that Hserin timed out and then jump to main (resetting the flag first).
Ioannis
Bookmarks