SERIN with Optional Timeout
Greetings,
I am using the SERIN command with the optional timeout parameter:
This code will place received data in temp1, or jump to the label NoMoreBytes if it does not receive data after 50 ms.
The help file indicates that the Timeout parameter can be a byte or word variable so I'd like to use:
Here, the Word variable holds the amount of time that SERIN waits. Since its a variable, I can change it in the program. When I try this, the assembly code gives me the impression that it does not use the value in the variable. Have I misinterpreted the Help file?
Thanks,
Joe
I am using the SERIN command with the optional timeout parameter:
SERIN rb.0,T38400,temp1,50,NoMoreBytes
This code will place received data in temp1, or jump to the label NoMoreBytes if it does not receive data after 50 ms.
The help file indicates that the Timeout parameter can be a byte or word variable so I'd like to use:
SERIN rb.0,T38400,temp1,theTimeOut,NoMoreBytes
Here, the Word variable holds the amount of time that SERIN waits. Since its a variable, I can change it in the program. When I try this, the assembly code gives me the impression that it does not use the value in the variable. Have I misinterpreted the Help file?
Thanks,
Joe
Comments
· I have verified the problem you described.
· The SERIN does not handle WORD variables for the TIMEOUT parameter correctly.
· If the timeout is·< 256 then use a BYTE variable.
· If the timeout must be > 255 then put this line just before the SERIN command:
This will load the __PARAM1 and __PARAM2 variables with the correct timeout value.
Let me know if this works for you.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
I've been away from the forum a while, and was browsing and this post attracted my attention.
As there is now a timeout for serin with SXB, what new documentation is there for the newest SXB, or do I just get the latest editor ?
This is great news for me.
Cheers,
Chris, WA.
Thanks for the suggestion! Here's an update.
I didn't try exactly what you asked so I can't say that it works or does not work. In my application, I wanted to wait for a Serial response for about 2 seconds and when I begin to receive it, I want to change the timeout to 10 milliseconds. So I had
where the variable named 'theExtra' has a value of 256 when 'theTimeOut' is 2100. When I begin to receive information, I change 'theExtra' to 0, and 'theTimeOut' to 10. I want to try just what you suggested tomorrow.
Joe
· You can download the latest compiler and the documentation (HTML or PDF) from this thread
· http://forums.parallax.com/showthread.php?p=597707
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·