问题
am new to Modbus and developing an application using Modbus RTU. I would like to know how to find out the RTU message frame separation time. In the Modbus RTU specification, It mentions 3.5 chars time, but there is no more data about how i can decide this intervals. and wat are the steps to calculate the separation time?
回答1:
Take a look at page 13 of the Modbus Serial Line Protocol and Implementation Guide V1.02
At the bottom you will find a remark explaining the inter-character time-out (t1.5) and inter-frame delay (t3.5) values.
For baud rates over 19200 values are fixed. For slower baud rates they need to be calculated (extract from SimpleModbusMaster library for Arduino):
// Modbus states that a baud rate higher than 19200 must use a fixed 750 us
// for inter character time out and 1.75 ms for a frame delay.
// For baud rates below 19200 the timeing is more critical and has to be calculated.
// E.g. 9600 baud in a 10 bit packet is 960 characters per second
// In milliseconds this will be 960characters per 1000ms. So for 1 character
// 1000ms/960characters is 1.04167ms per character and finaly modbus states an
// intercharacter must be 1.5T or 1.5 times longer than a normal character and thus
// 1.5T = 1.04167ms * 1.5 = 1.5625ms. A frame delay is 3.5T.
if (baud > 19200)
{
T1_5 = 750;
T3_5 = 1750;
}
else
{
T1_5 = 15000000/baud;
T3_5 = 35000000/baud;
}
回答2:
Modbus RTU use 11-bit char, regardless using parity or not. The formula should be : 11 * 1000000 / ( baud_rate ) for one char time, this applies for baud rate <= 19200 bps. For baud rate > 19200 bps, fixed time is used, which are 1750 micro seconds for 3.5 char time, and 750 micro seconds for 1.5 char time
来源:https://stackoverflow.com/questions/20740012/calculating-modbus-rtu-3-5-character-time