Closed azat385 closed 3 years ago
@azat385 ,
You can create a Serial object which talks to moxa via raw socket or even RFC 2217 (I think moxa supports both in all models). I recommend you use raw socket unless you need to change the serial line settings frequently (like using different baudrate)
Here is an example:
import serial
from umodbus.client.serial import rtu
serial_port = serial.serial_for_url("socket://moxa.acme.org:6610")
message = rtu.write_multiple_coils(slave_id=1, address=1, values=[1, 0, 1, 1])
response = rtu.send_message(message, serial_port)
serial_port.close()
Hope it helps.
@tiagocoutinho thanks a lot !
Hello!
Is it possible to use rtu frame over TCP connection? Slave rtu device is connected to pc via moxa nport 5150 through the ethernet. (Nport is changing just interface but not the messages)
Thanks a lot!