I am using minmodbus in lab automation, and many devices can read individual 2 register 32bit floats, (say a single 4-20 mAmp channel) but also allow reading multiple registers (so reading 4*2registers to give the current in 4 channels).
I have extended mm by adding FLOATS as a payload format and implementing a read/writefloats code in the relevant sections build request and parse results. (commented by @@@FLM). This essentially automates the combination of read/write REGISTERS and interpretation of the registers as 32bit FLOATS
This could also be extended to longs, but I have not done so, simply because I did not have the need.
I thought it might be useful to others to see, and maybe to implement in future releases of mm (which works great out of the box!)
I am using minmodbus in lab automation, and many devices can read individual 2 register 32bit floats, (say a single 4-20 mAmp channel) but also allow reading multiple registers (so reading 4*2registers to give the current in 4 channels).
I have extended mm by adding FLOATS as a payload format and implementing a read/writefloats code in the relevant sections build request and parse results. (commented by @@@FLM). This essentially automates the combination of read/write REGISTERS and interpretation of the registers as 32bit FLOATS
This could also be extended to longs, but I have not done so, simply because I did not have the need.
I thought it might be useful to others to see, and maybe to implement in future releases of mm (which works great out of the box!)
Cheers
Frans
minimalmodbus_FLOATS.txt