LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Listen for IP address from wago plc

First off I am new to the forms, so hello.

Also, I am new to coding in Labview and Wago plcs.

 

What I am trying to do is listen when the plc is connected and receive its IP address so that i can start transmitting data via modbus.

 

I am able to communicate with the plc if I have the IP address.

 But, I am not sure what the Listen function are looking for as so that is could program the Wago to send the appropriate signal.

 

Thanks 

0 Kudos
Message 1 of 10
(4,563 Views)

hello and welcome,

 

i am unfamiliar with "Wago plcs", but as far as i know Modbus is a protocol over RS485 (or Serial). But you suggest it is over IP/Ethernet.

 

in the first case, finding an IP address doesen't help you.

 

finding a device with IP address might be either via ARP protocol (if you know the MAC address) or just by brute force.

i can't say i know how to do it with labview primitives, but you could use the "System Exec.vi" to use the toolchain of your OS.

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 10
(4,539 Views)

Hello in this link there is a description of the library used for communication Wago to  LV.

I also attach this link where you can download the library and some examples.

Roger Garcia, Certified LabVIEW Developer

HTML tutorial

There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 3 of 10
(4,522 Views)

@jwscs wrote:

but as far as i know Modbus is a protocol over RS485 (or Serial). But you suggest it is over IP/Ethernet.


I have done Modbus over RS-232 and there is a standard for Modbus over Ethernet (there are just some minor tweaks between the serial and Ethernet versions).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(4,492 Views)

I do not have any experience using Wago plcs, but I was able to locate some documentation referencing the IP address. The link below gives insight into assigning an IP address to the controller, which must be unique within the network.

 

Refer to page 25 in the following link:

http://global.wago.com/media/2_products/q07500880_00000000_0en.pdf

0 Kudos
Message 5 of 10
(4,473 Views)

@EcthelionV wrote:

Hello in this link there is a description of the library used for communication Wago to  LV.

I also attach this link where you can download the library and some examples.


It looks like the WAGO device uses standard MODBUS TCP, so instead of the very old .dll described in the WAGO documentation, one could use the free MODBUS library currently provided by NI: https://forums.ni.com/t5/NI-Labs-Toolkits/LabVIEW-Modbus-API/ta-p/3524019

 

 

0 Kudos
Message 6 of 10
(4,438 Views)

@jardeneaux wrote:

 

What I am trying to do is listen when the plc is connected and receive its IP address so that i can start transmitting data via modbus.

 

I am able to communicate with the plc if I have the IP address.

 But, I am not sure what the Listen function are looking for as so that is could program the Wago to send the appropriate signal.

 


Do you mean that the WAGO node will have an IP address assigned before it's connected to the network, but you don't have any way to know what it is, and you want your LabVIEW application to determine it? Is this actually a PLC running its own program (and do you have access to make changes to that program), or is it just a fieldbus node, strictly a Modbus slave? 

 

If it's a PLC that can act as a Modbus master or slave, you could program it to send its address to your PC first before switching to acting as a slave. If it's strictly a Modbus slave, it won't be able to initiate any communications itself, it only responds to requests, so I don't see any way to have the WAGO node announce its presence. Perhaps by packet-sniffing you could detect its presence on the network if you knew its MAC address, but this wouldn't be easy to implement.

 

Will the WAGO be the only other thing on the network, and will it be on the same subnet as your PC (that is to say, will it have a similar address)? In that case maybe you could scan for it by pinging a range of addresses continuously until you get a reply.

0 Kudos
Message 7 of 10
(4,434 Views)

Yes the Wago node will have an IP address assigned before it is connected. Also, as of right now I do not know if the plc will be on the same subnet as the PC. 

 

Also I do have access to make changes to the PLC code.

 

Currently, I have the VI listening to a port but it looks like is more of an issue with the plc coding than building a Vi.

 

Every time the PLC tries to make a connection the error  "Socket is not connected " come up on the PLC. 

 

 

0 Kudos
Message 8 of 10
(4,426 Views)

So are you trying to have the PLC as the master make a Modbus TCP connection to the PC as slave, or vice versa? When you say you have the VI (the PC) listening to a port, do you mean you set up a Modbus slave on the PC to listen to port 502, or did you just use the TCP Listen function? It would help a lot if you could share your LabVIEW code (and maybe your PLC code too).

0 Kudos
Message 9 of 10
(4,421 Views)

I got it working. 

 

The problem was that my firewall was blocking the place from teytry to establish a connection .

0 Kudos
Message 10 of 10
(4,391 Views)