I have read the documentation and consult the examples (bandwitch-server-one.c) but there is something that I don't understand (my english is not good and google help me ... :) ).
How/when should I use the values of my registers in library code?
My program manages 3 sets of registers
0-1000
5000-7000
10000-12000
all contain 2 bytes, reading and writing.
I understand that
1) I have to create a ctx = modbus_new_tcp ("127.0.0.1", 1502);
2) I put the socket in listen state socket = modbus_tcp_listen (ctx, 1);
3) I wait for accept connection modbus_tcp_accept (ctx, & s);
4) I allocate mb_mapping mb_mapping =
modbus_mapping_new (MODBUS_MAX_READ_BITS, 0,
MODBUS_MAX_READ_REGISTERS, 0);
5) Receive the request rc = modbus_receive (ctx, query);
6) Respond with modbus_reply (ctx, query, rc, mb_mapping);
7) Free the resources
ok? But when/where should I use the values of my registers 0-1000 / 5000-7000 etc.?
I'm sure this is a stupid question, thank you for your time