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

Handling Multiple Slave Addresses with libmodbus on a Single Interface #747

Open
piratkin opened this issue May 24, 2024 · 0 comments
Open
Assignees

Comments

@piratkin
Copy link

piratkin commented May 24, 2024

Hi!

I need to create a virtual network of devices on one physical communication interface (RTU).
However, from what I understand, the current implementation of the libmodbus library doesn't support
listening and responding to a Modbus client using different slave addresses on the same physical interface.
I tried listening to each slave_id in a separate thread, but it seems this doesn't work when the physical interfaces overlap.

libmodbus version

3.1.10

OS and/or distribution

Arch Linux

Environment

x86-64

Description

It would be helpful if it were possible to wait for messages from any or random slave_id address instead of a predetermined one.

Actual behavior if applicable

modbus_set_slave(ctx, SERVER_ID);
modbus_receive(modbus, query);

Expected behavior or suggestion

modbus_set_slave(ctx, ANY_SERVER_ID);
modbus_receive(modbus, query);

or

modbus_receive_any(modbus, query);

or something else

@stephane stephane self-assigned this Jul 17, 2024
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

No branches or pull requests

2 participants