--
You received this message because you are subscribed to the Google Groups "modbus-tk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modbus-tk+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hello,
I'm writing in this thema because I have a problem with modbus-tk lib on linux. So I have the same program to communicate with motor controllers that I'm using on window machne and it working good. But since we want to transfer everything on linux machine i found a problem.
As i said program is working good on Windows XP, but on debian 6 it does not. The error traceback is:
Traceback (most recent call last):
File "modbus_test.py", line 17, in <module>
first_motor_comm.enable_motor()
File "/home/dagor/workspace/modbus_test_ziherica/modbus_communication.py", line 111, in enable_motor
self.protocol.write_registers(self.address, MotorCommunication.DGTINSET.register_number, [1])
File "/home/dagor/workspace/modbus_test_ziherica/modbus_communication.py", line 58, in write_registers
self.master.execute(motor_address, cst.WRITE_MULTIPLE_REGISTERS, start_registar, output_value=data)
File "build/bdist.linux-i686/egg/modbus_tk/utils.py", line 26, in new
modbus_tk.modbus.ModbusInvalidResponseError: Response length is invalid 0
Both operating systems are on the same phisical computer with pyhon2.7.3 and modbus-tk-0.4.2. I don't think that problem is with controllers or hardware because it's working with pymodbus library which also use pyserial. If you want to see code you can find it here: http://marvin.kset.org/~denis/code/
I like your library a lot and would really like to use it in the future!
Thanks for any help!
Hi Luc,
We run RTU Server on serial line at high speed (115000 baud). We observed that the serial line handler had difficulty in detecting frames and so had to estimate the message length from the header and look out for those many number of bytes. This was done for the Write-multiple-registers message and not for others. Today I looked at the Modbus Serial line standard and the Modbus-tk code. I have some questions and suggestions please.
Modbus Serial line specs sheet is inline. For high speed serial line, the fixed time values for intercharacter-timeout (t1.5) is 750 microsecs and inter-frame delay (t3.5) is 1.750 ms. Modbus-Tk calculates these from 1) utils.calculate_rtu_inter_char(baudrate): as 0.0005 and 2) in RtuServer (modbus_rtu.py) __init__ with:
self._t0 = utils.calculate_rtu_inter_char(self._serial.baudrate) # 0.0005
self._serial.interCharTimeout = 1.5 * self._t0 # 0.00075
self._serial.timeout = 10 * self._t0 # 0.005. 5 ms much longer than the allowed 1.75 ms.
Why is there a magic number 10. It should have been 3.5. Better to avoid magic numbers but use:
# modbus_rtu.py class -> RtuServer(Server):-> def __init__(self, serial, databank=None):
interframe_multiplier = 3.5
interchar_multiplier = 1.5
self._serial.interCharTimeout = interchar_multiplier * self._t0 # 0.00075 s = 750 microsec
self._serial.timeout = interframe_multiplier * self._t0 # 0.00175 s = 1.75 ms
--
You received this message because you are subscribed to the Google Groups "modbus-tk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modbus-tk+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to a topic in the Google Groups "modbus-tk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modbus-tk/cCLt2TVXoSg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modbus-tk+...@googlegroups.com.