timeout
at_jay
Posts: 16
Hi all!
I am looking forward for some immediate help in realm of the timeout function using propeller.
In case of FullDuplexSerial.spin we have rxtime(ms) PUB function that takes serial in the char value if not within time 'ms' it will step forward and execute next instruction.
I want to implement the similar case for ParallaxSerialTerminal.spin case for the PUB function DecIn.
The code for the FullDuplexSerial.spin is
PUB rxtime(ms) : rxbyte | t
'' Wait ms milliseconds for a byte to be received
'' returns -1 if no byte received, $00..$FF if byte
t := cnt
repeat until (rxbyte := rxcheck) => 0 or (cnt - t) / (clkfreq / 1000) > ms
How should I implement the same for ParallaxSerialTerminal.spin DecIn case? or how to modify the case for former for Decimal entries instead of char?
Looking forward for your help.
Thanks
Jay
I am looking forward for some immediate help in realm of the timeout function using propeller.
In case of FullDuplexSerial.spin we have rxtime(ms) PUB function that takes serial in the char value if not within time 'ms' it will step forward and execute next instruction.
I want to implement the similar case for ParallaxSerialTerminal.spin case for the PUB function DecIn.
The code for the FullDuplexSerial.spin is
PUB rxtime(ms) : rxbyte | t
'' Wait ms milliseconds for a byte to be received
'' returns -1 if no byte received, $00..$FF if byte
t := cnt
repeat until (rxbyte := rxcheck) => 0 or (cnt - t) / (clkfreq / 1000) > ms
How should I implement the same for ParallaxSerialTerminal.spin DecIn case? or how to modify the case for former for Decimal entries instead of char?
Looking forward for your help.
Thanks
Jay
Comments
If you need a 4 byte LONG value then create a loop that reads, validates, and stores the 4 bytes in memory. Use the rxbyte method of the Full-Duplex Serial object to read the bytes without blocking.
Since ParallaxSerialTerminal has an rxcheck routine, you can just add the same rxtime routine routine to it that you showed. DecIn uses the routine StrInMax which uses CharIn which uses rxcheck. You could substitute a call to rxtime for the call to CharIn to come up with a StrInMaxTime routine, then you'd have DecInTime call StrInMaxTime.
meanwhile thanks for the support, will take care in future.
Thanks
Jay