read separate registers in modbus
Hello,
need help reading separate registers. For example I have 150 objects and gap between registers is 120, so I need to read register 20001 for object_1 and 20121 for object_2. Then I create for every object function block Modbus Read it gives big load on controller. Maybe it's possible to create table for mapping registers?
need help reading separate registers. For example I have 150 objects and gap between registers is 120, so I need to read register 20001 for object_1 and 20121 for object_2. Then I create for every object function block Modbus Read it gives big load on controller. Maybe it's possible to create table for mapping registers?
Answers
As stated on modbus protocol specification, every read is based on consecutive register addresses, so in the case of these gaps, you need to poll registers trying to make it in the less amount of reading requests, on the side on controller; you can't build something, such as a table to reduce the amount of requests, because this depends on the slave's register addresses.
There are some devices (from the side of modbus slave) where you can make a custom table allowing to arrange the registers in the way you need, allowing to retrieve the whole set of registers in a few read requests, but this is only possible if a such device is built with this kind of configurable functions
Hi,
In addition to the above answer:
- normally you should execute each read or write FB after the previous one has finished (REQ input = DONE output of previous = consequent execution of the blocks)
- you can place the read or write blocks in a separate task, with slower fied execution (if possible)
What controller do you asking for?
In addition to the above answer:
- normally you should execute each read or write FB after the previous one has finished (REQ input = DONE output of previous = consequent execution of the blocks)
- you can place the read or write blocks in a separate task, with slower fied execution (if possible)
What controller do you asking for?
I'm confused by your example ...
Modbus address registers should start with "0", "1", "3" or "4"
150 addresses separated by 120 would require 18000 memory addresses, which will not fit in your address range - ie , if the first register is 20001, then the last register would be 218000.
However, If you are reading Boolean coils, then 120 bits is only 15 bytes . What happens if you just read everything, including the spaces, with a single Function Code ?
Modbus address registers should start with "0", "1", "3" or "4"
150 addresses separated by 120 would require 18000 memory addresses, which will not fit in your address range - ie , if the first register is 20001, then the last register would be 218000.
However, If you are reading Boolean coils, then 120 bits is only 15 bytes . What happens if you just read everything, including the spaces, with a single Function Code ?
Add new comment