thanks for providing modbus4j as free software.
Recently I started using modbus4j in a little project feeding some data from our house into rrdtool for long term visualisation.
I was wondering how to handle the IEC 61131-3 data type BYTE which is defined as an 8-bit bit string.
There is no 8-bit data type in modbus4j.
I know that Modbus only defines single bit or register (16-bit) operations. On the slave I can define 8-bit BYTE values and it would be great if there would be a convenience method retrieving it.
Something like the convenience methods for retrieving bit values.
batchRead.addLocator("FirstByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 0); //retrieves first byte from register 256
batchRead.addLocator("SecondByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 1); //retrieves second byte from register 256
I planned on hacking this into my own modified version of modbus4j.
My plan is to define this as java primitive short since BYTE in IEC 61131-3 is unsigned and there is no unsigned 8-bit value in java.
Is this something of general interest? Since modbus4j is free software I'd like to offer my modifications back to the project.