Modbus profile mapping vs script - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus profile mapping vs script (/showthread.php?tid=2995) |
Modbus profile mapping vs script - Andey - 19.11.2020 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) RE: Modbus profile mapping vs script - Daniel - 19.11.2020 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. RE: Modbus profile mapping vs script - admin - 19.11.2020 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. RE: Modbus profile mapping vs script - Andey - 19.11.2020 Thank you all |