Simple Serial Maximum Delay
tpw_man
Posts: 276
What is the maximum delay in clock cycles that I can wait with Simple Serial before I miss a byte? I am doing this at 80 MHz and 19.2K baud. Do I have to do an unrolled loop, or can I wait a few dozen spin instructions before I will miss the byte?
I will do something like this:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
I will do something like this:
repeat until ser.rx == "!" repeat 2 buffer := ser.rx if compare(@buffer, string("HI"),2) repeat 50
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Comments
EDIT: Would my idea work?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Post Edited (tpw_man) : 7/30/2008 4:28:24 PM GMT
You would need some variable that is TRUE if in transmit mode or FALSE if in receive mode and the Spin cog that's actually doing the I/O would check this variable before starting the next character and choose either the transmit or receive routine to do next (and switch the direction of the I/O pin appropriately). If it's in transmit mode, the receive buffer will not get filled. If it's in receive mode, the transmit buffer will not get emptied. You'll want to add some kind of error checking so the tx routine won't continue to wait if the transmit buffer is full and it's in receive mode. Similarly, you'll want to make sure the receive routine won't continue to wait if the receive buffer is empty and it's in transmit mode.