Calculating modbus RTU 3.5 character time

后端 未结 2 1190
名媛妹妹
名媛妹妹 2021-02-04 14:21

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

相关标签:
2条回答
  • 2021-02-04 14:49

    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

    0 讨论(0)
  • 2021-02-04 15:08

    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; 
    }
    
    0 讨论(0)
提交回复
热议问题