ljean / modbus-tk

Create Modbus app easily with Python
Other
566 stars 212 forks source link

Is the calculate_rtu_inter_char function propley. #123

Open moebiusever opened 4 years ago

moebiusever commented 4 years ago

In this function:

def calculate_rtu_inter_char(baudrate): """calculates the interchar delay from the baudrate""" if baudrate <= 19200: return 11.0 / baudrate else: return 0.0005

According Modbus Specs http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf,

The implementation of RTU reception driver may imply the management of a lot of interruptions due to the t1.5 and t3.5 timers. With high communication baud rates, this leads to a heavy CPU load. Consequently these two timers must be strictly respected when the baud rate is equal or lower than 19200 Bps. For baud rates greater than 19200 Bps, fixed values for the 2 timers should be used: it is recommended to use a value of 750µs for the inter-character time-out (t1.5) and a value of 1.750ms for inter-frame delay (t3.5).