LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicating via Ethernet with Eaton module

Hello all, I am new to the NI forums. I am using Labview with my company to try to read/write data from registers on an Eaton C441 with Ethernet module. The current setup I have is running power to the module itself and the Ethernet module, then running into an Ethernet switch, which I am connecting to my laptop via an Ethernet cable. I have put my laptop and the module on the same subnet, and am able to see the values on the registers via Eaton's proprietary website (putting the IP address into a web browser). So I am confident that my computer is able to communicate with the module.

 

My problem comes when trying to interface with Labview. I will be the first to admit that while I am slightly familiar with the software, I have never done anything in Labview utilitzing Ethernet. I will attach the simple program I am trying to get to work to this message. Basically, my understanding is that with the attached program, I need to put in the module's IP address, a timeout other than zero, and a remote port. I am unsure of the remote port, so I have been using 1. Also, for the "data in" field, I assumed I should use the PID numbers given by Eaton to read/write to the individual registers. I tried that, but every time it times out and gives me an error that it exceeded the program time. Does anyone have any advice or suggestions on what I can do to get this to work? Like I said, I am definitely not a Labview expert so I have no idea what I'm doing wrong, or if this program is written to do what I need it to do. Thank you for your help!

 

Attached you will find my VI, the User manuals for the C441 and the Ethernet module.

Download All
0 Kudos
Message 1 of 14
(4,286 Views)

Browsing through your docs, there is a whole layer on top of the network connection, so it will not be as simple as your pogram has it laid out.

 

The device appears to support EtherNet/IP.  I hate this name because it is confusing, as it is not Ethernet/ the type of connection, but a communication protocol.  I have not found a free publication of the standard (they want way too much money for it).  NI does offer a toolkit (I have neever used it):

 

https://www.ni.com/en-us/shop/product/ni-industrial-communications-for-ethernet-ip.html

 

It also appears the device support TCP Modbus.  This is another layer, but NI has a free toolkit for it (if you search the forums, there are probably other examples as well):

 

 

0 Kudos
Message 2 of 14
(4,281 Views)

Thanks for your reply, Matthew. I had kind of feared that it wouldn't be a simple solution. My company bought the Ethernet module add on in addition to the core C441 module specifically to communicate via Ethernet, so I do not think they want to go the Modbus route. I'll try to find some examples on here using the toolkit and see what I can come up with. I haven't had much luck yet though, which is why I finally posted something here. Thanks for the help though!

0 Kudos
Message 3 of 14
(4,275 Views)

This is where Ethernet (the physical connection and cable) can be confused with EtherNet/IP the communications protocol.  This is why I hate the naming convention that the EtherNet/IP governig body chose.  TCP Modbus still runs over the Ethernet physical connection.  It is a different communications protocol.  You would still be using the module they purchased.

0 Kudos
Message 4 of 14
(4,273 Views)

Oh, I wasn't aware of that. It looks like the free toolkit is a bit buggy based on user feedback, but I'll give it a try and see if I can find some examples. I had assumed I had that toolkit since I was able to use the TCP read/write/start/stop objects on my block diagram. I'll report back tomorrow, thanks Matthew!

0 Kudos
Message 5 of 14
(4,271 Views)

It's been a few years since I have used it.  I looked back at that project, and I ended up using the modbus library to get the info about the protocol I needed and made my own VIs to talk to the device.  I don't recall if it was due to errors/bugs or just trying to simplify all the overhead.  One of the comments linked to a commercial library (free to evaluate) that you may have better luck with.

0 Kudos
Message 6 of 14
(4,268 Views)

You can also try Google to understand the protocol.  From Wikipedia:

 

http://en.wikipedia.org/wiki/Modbus

 

The low level VIs you have in your original posting will work.  You just need to add the overhead of the protocol.  The port number should be 502, BTW.

0 Kudos
Message 7 of 14
(4,266 Views)

Great, I'll try to understand the protocol and edit the VI I already have. Thanks so much Matthew!!

0 Kudos
Message 8 of 14
(4,254 Views)

Since the Eaton module supports both protocols...

 

I would recommend using the ModbusTCP function pallete

1) It's free,

2) It's a bit easier to use than the Ethernet/IP Industrial Tool Kit

 

If performance and flexibility is not important you can also use the NI Modbus I/O Server.

 

0 Kudos
Message 9 of 14
(4,243 Views)

I found this example program, would it be applicable to what I'm trying to do? https://forums.ni.com/t5/Example-Code/Using-TCP-Functions-to-Connect-to-a-HTTP-Server-in-LabVIEW/ta-...

 

By typing in the IP address in a web browser, I'm able to see Eaton's software and view/change all of the registers. What I want to do is find a way to write those values into an excel spreadsheet. Could I do that with the VI on the attached link?

0 Kudos
Message 10 of 14
(4,223 Views)