Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication with Beckhoff 9020 via Modbus

I am having trouble with Modbus TCP/IP protocol (with an Ethernet cable) and the BC9020 Bus Terminal Controller. I’m a complete beginner with Modbus, so I apologize in advance.

 

My set-up is as follows:

1 BC9020

1 KL 3222

1 KL 9010 (end terminal)

1 PT100 (temperature sensor)

 

Basically, I'm trying to read the value from the temperature terminal (KL 3222) with Labview. I had previously been using a Wago controller where I communicated using a driver, and my program worked fine.

 

I am able to connect with the controller using the TCP Open Connection function (I enter in IP and port number), but that's it. I don't know where to go from there, and I'd appreciate any tips.

 

I have tried to follow this thread, but  I'm still lost. 

 

I have downloaded the modbus library, but also nothing seems to work for me.

https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Modbus-API/ta-p/3524019

 

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

Hi,

 

The library you used does not work for MB TCP.

 

You either buy a good MB library or build the VI's yourself. I always do the last because we use a lot of dedicated MB commands beside the standard commands.

To get started the attached VI is an example how you can read MB registers from a MB TCP slave.

 

Kees

0 Kudos
Message 2 of 3
(5,235 Views)

@K C wrote:

Hi,

 

The library you used does not work for MB TCP.

 

 

Kees


That is incorrect. That Library works just fine for TCP. I used it for years before recently changing it ofr the new Modbus API.

 

Using this library.....

 

case statement with 3 states inside a while loop: Dial, Talk, Hang Up

Dial state does the open TCP connection

Talk state does the read (or write) holding registers...Or whatever function blocks from this library you want to use.

Hangup state closes TCP connection.

 

Pass TCP connection refnum via shift registers.

Dial (No Error? goto talk, Error? go to hangup)

Talk (No Error? goto talk again Error gotot hangup)

Hangup (go to dial)

 

 

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