Logic Machine Forum
JSON "read count" mapping field - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: JSON "read count" mapping field (/showthread.php?tid=613)



JSON "read count" mapping field - Mirco - 13.02.2017

Hi,
when I read like 150-200 registers from a modbus TCP fire-central but often some registers weren't read.
This central returns an error if I try to read more than 20 registers at once.
I saw that my HL reads registers one by one, so I think that the fire-central have a small buffer and sometimes it lost some request.
If I use "read count" mapping field, can it resolve this problem? And I don't understand how to use this mapping field, can someone explain it? Wink

PS: The registers that I would read are not always contiguous.


RE: JSON "read count" mapping field - Erwin van der Zwart - 13.02.2017

Try this:

r1,r2,r3,r4 = mb:readregisters(1000,4)
r5,r6,r7 = mb:readregisters(1010,3)
r8,r9,r10,r11,r12,r13 = mb:readregisters(1040,6)

BR,

Erwin


RE: JSON "read count" mapping field - admin - 13.02.2017

In your mapping each register belonging to a block that you want to read at once should have the same address and read_count value. The real ModBus address is set by the read_offset parameter. This way each block is read only once and then cached, so every other register value belonging to the same block is taken from cache without any sending anything to the slave.


RE: JSON "read count" mapping field - Mirco - 15.02.2017

Thank you! I tryed it and now, using "read_count" and "read_offset" I resolved most of the problems!
The only problem that happened sometimes is that with 2 registers the HL read wrong values.. and after it hapened those value didn't change until, for example I manually exclude the sensor bound to the register..
If I read from the central with an external software, it returns the right value, so I don't understand if it is a problem of the HL or of the central Huh