How long does a BS2 take to send a number? - CLOSED
davejames
Posts: 4,047
Hi All,
I'm bashing my way through understanding serial communication between a BS2 and VB2005; a question has popped up...
---> How long does it take a BS2 to send a number if the BS2 is set up for 9600 baud (baudmode 16468)?
I've read the SERIN/SEROUT chapters in the programming reference·and Nuts&Volts column #16 "Serin and Serout Demystified" - no help.· Values of time calculated from information in these writings make no sense.
Grateful for any insight,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (davejames) : 12/11/2009 9:34:12 PM GMT
I'm bashing my way through understanding serial communication between a BS2 and VB2005; a question has popped up...
---> How long does it take a BS2 to send a number if the BS2 is set up for 9600 baud (baudmode 16468)?
I've read the SERIN/SEROUT chapters in the programming reference·and Nuts&Volts column #16 "Serin and Serout Demystified" - no help.· Values of time calculated from information in these writings make no sense.
Grateful for any insight,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (davejames) : 12/11/2009 9:34:12 PM GMT
Comments
9600 bps translates to roughly 960 bytes per second with a single binary value (number) taking 10 bites to send...start, 8 data bits and stop bit. There is however the load time of the instruction and the setup time of formatting or parameters, so really the time it takes is variable depending on a number of factors. About all you can be sure on is once the first bit leaves, the others will be at the same bit rate making the actual transfer of the number take 1/960th of a second. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Check out the new Savage Circuits TV!
·
Thank you, yes it helps.
Can you resolve for me a comment in the Nuts&Volts column #16 "Serin and Serout Demystified"? It's located between Tables 16.1 and 16.2 ("One frame of serial data", "SC2-IC baudmode dissected"). The comment reads:
-->"The BS2's internal process for organizing and sending the bits apparently involves 20ms of overhead..."
Is this overhead what you were referring to as "...the load time of the instruction...setup time of formatting..."?
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
·
20 mS seems like a long time...I don't think it takes that long, but there is loading the instruction from the EEPROM as well as setting up the parameters for the transmit. This can take more time than sending a single byte @ 9600 bps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Check out the new Savage Circuits TV!
·
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Check out the new Savage Circuits TV!
·
For example in the following statement,
SEROUT 14\15,$54,[noparse][[/noparse]dec x] ' 3500 microseconds setup, extra 180 us between bytes
it takes a BS2 about 3.5 milliseconds from the time p15 allows flow until the first start bit of the data. Then, between each decimal digit, there is an extra 180 microseconds, which amounts to a total of 2.8 stop bits (including the usual 1). The setup time is about 500 microseconds longer if flow control is not used.
The minimum setup time comes from statements like
SEROUT 14\15,$54,[noparse][[/noparse]x] ' setup 480 us, or 920 us without flow control
The process of formatting data (DEC, HEX) eats up processing time before the first bit is sent. The fastest intercharacter times come from the STR modifier for an array:
SEROUT 14,$54,[noparse][[/noparse]STR x\6] ' setup 980 us, intercharacter ~2.5 stop bits total.
If the statement is in a loop, there will be lots of time spent interpreting instruction code. Echoing what Chris said, the time it takes is variable depending on a number of factors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thank you for follow up information. I'll copy this into my lab notes.
Merry Christmas to you,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔