LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus can't read INT but can if INT[]

I'm using NI Modbus Library (v1.2.1.42) (from VIPM) in LabVIEW pro 2020.  I'm communicating with a Micro850 PLC.  I have no problem reading a holding register (40000) with the variable in the PLC set as INT with dimension set as [1..N] where N is 2 to 16.

 

However, when the variable is simply an INT with no dimension set or dimension set as [1..1], I get an error code 538182 and a source "<APPEND>Function 3" message.  Function 3 is

Illegal Data Value The value contained in the query's data field is not acceptable to the slave.

 

I tried using the "Plasmionique Modbus Master" library but got the same result.  Is the problem reading an INT that's not dimension due to the LabVIEW Modbus libraries, or am I missing a configuration set up?

0 Kudos
Message 1 of 4
(303 Views)

Modbus addresses usually start with xxxx1, not xxxx0.  Do you get the same error if you read register 40001 with a length of 1?

0 Kudos
Message 2 of 4
(276 Views)

I apologize for not being clear.  I showed 40000 to show that I'm using holding registers and not coil.  The variables are at 40100 and 40105.  If the PLC variables for 40100 and 40105 aren't dimensioned as [1..2], I can't read/write with a length of 1.  Instead, I get the previously mentioned error.

 

I've submitted a ticket to LabVIEW tech support to find out if this error is due to LabVIEW or a configuration that I've missed.

0 Kudos
Message 3 of 4
(253 Views)

The response is determined by the device which sends it. My guess would be that the value in that address is a 32 bit integer, which requires 2 holding registers, and the device is smart enough to return an error if you don't ask for both registers.

 

That said, that's just a guess. You should look at the device documentation to see how the values are defined. Since it's a PLC, I'm assuming its programming software has a place to define what the different values are.


___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(231 Views)