Baudrate - Can someone check my math please..
pacman
Posts: 327
Ok,
I'm writing a modbus (slave) implementation and I need to figure out the 3.5 character spacing at the end of an RTU frame.
Now, I _think_ I've got the right maths, but can someone please check my thinking before I madly code...
9600 baud = 1 bit in 1/9600 of a second.
A character (7,E,2) is 11 bits long.
Thus a 3.5 character 'frame end' space is 3.5 * 11 * 1/9600 of a second.
Which would be just a shade over 4mS.
Am I correct?
I'm writing a modbus (slave) implementation and I need to figure out the 3.5 character spacing at the end of an RTU frame.
Now, I _think_ I've got the right maths, but can someone please check my thinking before I madly code...
9600 baud = 1 bit in 1/9600 of a second.
A character (7,E,2) is 11 bits long.
Thus a 3.5 character 'frame end' space is 3.5 * 11 * 1/9600 of a second.
Which would be just a shade over 4mS.
Am I correct?
Comments
Modbus RTU uses a 3.5 character space of no transmission to signify the end of a message/start of the next message.
So if I get no data for 3.5 * 1.14583333...etc milliseconds, then the message is over and I should actually process it.
Thanks again for the sanity check.....
FullDuplexSerial has a similar function with a slight difference in the parameters.
The call returns the next character or -1 if it timed out.
Oops....uarts.rxtime function accepts only integer mS values for timeout. I've got to stop posting answers so late. Make too many silly mistakes.