Hi all,

I have tried to query values from the holding register of a simulated modbus 
device and process them as integer using the following code:
// read integer / holding register
                    PlcDriverManager driverManager = new PlcDriverManager();
                    String conString = "modbus:tcp://localhost";
                    PlcConnection plcCon = 
                    PlcReadRequest.Builder builder = 
                    builder.addItem("value", "readholdingregisters:1");
                    PlcReadRequest readRequest = builder.build();
                    PlcReadResponse resp = readRequest.execute().get();

This runs well, but when I try to handle the result as integer (using 
resp.getInteger("value")) I always get null as result no matter what's in the 
For Boolean values in the coil this works without any problem (using 
getBoolean() of course).
Another approach I tried is using the getAllByteArrays("value"); command, but I 
haven't found a way to get the returned collection of byte arrays into integers.

Can you give me an indication of what my problem may be or what I'm doing wrong?

Thank you very much in advance!


Reply via email to