This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

JSON "read count" mapping field
#1
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.
Reply
#2
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
Reply
#3
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.
Reply
#4
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
Reply


Forum Jump: