Hi all,

today I implemented support for some quite odd encodings:
LITTLE_ENDIAN_BYTE_SWAP and BIG_ENDIAN_BYTE_SWAP.
Also did I add support for custom overriding of the connections default 
byte-order in Modbus on a per tag basis.

//final PlcConnection connection = new 
DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=BIG_ENDIAN");
final PlcConnection connection = new 
DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=LITTLE_ENDIAN");
//final PlcConnection connection = new 
DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=BIG_ENDIAN_BYTE_SWAP");
//final PlcConnection connection = new 
DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=LITTLE_ENDIAN_BYTE_SWAP");
final PlcReadRequest readRequest = connection.readRequestBuilder()
.addTagAddress("16 bit BigEndian", 
"holding-register:1:WORD{byte-order:'BIG_ENDIAN'}")
.addTagAddress("16 bit LittleEndian", 
"holding-register:2:WORD{byte-order:'LITTLE_ENDIAN'}")
.addTagAddress("32 bit BigEndian", 
"holding-register:3:DWORD{byte-order:'BIG_ENDIAN'}")
.addTagAddress("32 bit LittleEndian", 
"holding-register:5:DWORD{byte-order:'LITTLE_ENDIAN'}")
.addTagAddress("32 bit BigEndianByteSwap", 
"holding-register:7:DWORD{byte-order:'BIG_ENDIAN_BYTE_SWAP'}")
.addTagAddress("32 bit LittleEndianByteSwap", 
"holding-register:9:DWORD{byte-order:'LITTLE_ENDIAN_BYTE_SWAP'}")
.addTagAddress("64 bit BigEndian", 
"holding-register:11:LWORD{byte-order:'BIG_ENDIAN'}")
.addTagAddress("64 bit LittleEndian", 
"holding-register:15:LWORD{byte-order:'LITTLE_ENDIAN'}")
.addTagAddress("64 bit BigEndianByteSwap", 
"holding-register:19:LWORD{byte-order:'BIG_ENDIAN_BYTE_SWAP'}")
.addTagAddress("64 bit LittleEndianByteSwap", 
"holding-register:23:LWORD{byte-order:'LITTLE_ENDIAN_BYTE_SWAP'}")
.build();


Chris

Reply via email to