Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modbus RTU over TCP #91

Closed
azat385 opened this issue May 21, 2020 · 2 comments · May be fixed by #93
Closed

Modbus RTU over TCP #91

azat385 opened this issue May 21, 2020 · 2 comments · May be fixed by #93

Comments

@azat385
Copy link

azat385 commented May 21, 2020

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!

azat385 pushed a commit to azat385/uModbus that referenced this issue May 28, 2020
Sending rtu ADU over tcp socket aka "modbus rtu over tcp"

Should fix AdvancedClimateSystems#91
@tiagocoutinho
Copy link
Contributor

tiagocoutinho commented Nov 7, 2020

@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.

@azat385
Copy link
Author

azat385 commented Dec 7, 2020

@tiagocoutinho thanks a lot !

@azat385 azat385 closed this as completed Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants