From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

code 56 at TCP Read in MB Ethernet Receive.vi

Hello,

 

I am trying to communicate with a unitronics PLC via ModBus tcp/ip, I use a simple VI with a TCP open connection.vi and a MB Ethernet Master Query.vi. Unfortunately, I am able to write registers or coils to PLC even though an error 56 is occured at MB Ethernet Receive.vi but I am not able to read from PLC because of that error. I changed the value of timeout and the result was the same.I also  have tested the communications via ModBus serials vi and the outcome was successful.

Any suggestions? I have already searched the forum and the site of NI without success......

The version of Labview is 8.5 on Windows XP.

0 Kudos
Message 1 of 5
(3,507 Views)

Hi zankour,

are you sure you send some data from PLC back to PC? Maybe you receive to less values? The error tells you that you didn't receive the expected number of values in the given time.

 

Mike

Message 2 of 5
(3,506 Views)

adding to Mike's post...

 

Check the addressing of your registers. If you ask for an address that is wrong, you will not be able to read it so ------> Time Out.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 5
(3,489 Views)

Hi Mike,

 

Thanks for the reply.Your assumption was correct PLC didn't send data (I checked it from plc's registers indicating the number of transmit and receive session) so I tried to communicate with it via an OPC server to see if this is a problem of PLC or Labview . The result was successful (modbus IP), but I notice that in the parameters the module ID was necessary which is not in Labview (according to Ethernet example master.vi) so I added the MBAP header and the problem was solved. What is funny is that the ID in MBAP needn't to correspond to the actual ID of the PLC. I guess I 've missed something... The truth is that I haven't much experience neither in Labview nor in modbus.

0 Kudos
Message 4 of 5
(3,460 Views)

Try the ethernet query llb file that I put in this thread. Then compare it to your code.

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=144522&query.id=35841#M144522

0 Kudos
Message 5 of 5
(3,425 Views)