Hello to all programmers out there,
I think I have a basic understanding problem about the libmodbus library and I've been looking for a reasonable answer for a while but couldn't find one. Hence my question here in the forum:
Using the libmodbus library, I have written 2 applications (1 client and 1 server application) which also run on 2 separate ARM processors. Both processors are connected to each other via Ethernet and use the TCP/IP protocol to exchange data.
The Modbus client writes an integer value to a register on the Modbus server using the modbus_write_register()
command. Now I would like to read out this value on the Modbus server itself. That means, I would like to have the transmitted integer value available again on the Modbus server itself.
Using the libmodbus library, what is the correct approach for this? Which libmodbus functions do I have to use for this?
I have already tried to read the value on the Modbus server using the modbus_read_registers()
command and as specified in this example https://libmodbus.org/olddocs/v3.1.7/modbus_read_registers, but I only get error messages .
Is this even the right approach, can the server actually read its own registers?
Thank you all for your replies and as always: Happy Coding :) Lars