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.

Modbus profile mapping vs script
#1
Hello.
I want to compare serial bus loading in case of use modbus mapping feature and modbus script control in the case of sequential registers access.
Modbus protocol assumes that read/write operations with multiple sequential registers can be performed using single request. Caller can to specify function, first register index, registers number and size. So if I need to read 64 sequential registers that have 4 bytes length I can:
* Create single read request to read 256 bytes.
* Create 64 requests to read 4 bytes on each request.

My questions are:
- When I use mapping feature does LM engine is smart enough to understand that some registers in the profile map are sequential and to create one request but not 64 requests?
- If I use 'luamodbus' library (class instanced?) does code below creates one request to read 20 registers, or 20 requests will be created to read each register?
Code:
i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19 = mb1:readregisters(0, 20)
Reply
#2
It is quite simple, the code above it is one request as the definition for read multiple registers. In profile each registry definition is one request. The datatype define how many registers will be read at once. The biggest possible is int64, the limit is simply for conversion to object. In your example you will have to manually convert everything and write to objects.
------------------------------
Ctrl+F5
Reply
#3
You cannot read more than 125 registers (250 bytes) at once, this is defined in modbus standard.

In the profile you can specify read_count / read_offset fields to read a large block at once. For each register within the same block read_count and address fields must be the same, read_offset tells where the actual data is stored (final address = base address + read_offset).

When using luamodbus directly it will do one read with the specified length.
Reply
#4
Thank you all
Reply


Forum Jump: