Serial Timeout
I want to receive a serial data.
but if it timed-out, I want to do some other tasks
if I used this function:
FUNC RX_Byte
· ·tmp var byte
·SERIN Ser_pin, Baud, tmp,__PARAM1,timeout······· ' receive a byte
·return tmp
ENDFUNC
timeout:
can I branch out to timeout lable outside the function?
do I have to add "return" at the end of timeout: ?
how can I go back to where the function was called from?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
but if it timed-out, I want to do some other tasks
if I used this function:
FUNC RX_Byte
· ·tmp var byte
·SERIN Ser_pin, Baud, tmp,__PARAM1,timeout······· ' receive a byte
·return tmp
ENDFUNC
timeout:
can I branch out to timeout lable outside the function?
do I have to add "return" at the end of timeout: ?
how can I go back to where the function was called from?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
Just put a goto after the SERIN to the RETURN.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
In my case __PARAM1 already has the received byte (or 0 if on a timeout) so there is no need for RETURN.