TCP/IP Communication between AB PLC and PC

limsgp

Member
Join Date
Jul 2011
Location
Singapore
Posts
25
Hi, I would like to ask if it is possible for the PLC to communicate with the PC via ethernet, and using C++ or VB on the PC.

For e.g. I just want to send a text string from PLC to PC and vice versa, is it possible?

Any links or references would be greatly appreciated.

I attempted to use the MSG instruction in RSlogix 5000, but somehow, couldn't figure out what should the correct setting be. I just want it to send/receive a string via TCP/IP.

Appreciate any advise. Thanks.

PS: My question is on the PLC side only, on how to configure the MSG instruction or what instruction to use to send a string to an IP address.
 
Last edited:
Its possible to do, however i don't believe you can do it with a MSG instruction. I believe you will have to use some type of drivers to allow the PC to talk to the PLC, such as one of the non-free RSLinx versions.

I've never done it, and i could be completely wrong on that information, but it is a lot more complicated than just setting up a MSG instruction. There are probably 9000 ways to do this, hopefully other users can guide you down the easiest and cheapest path.
 
Thanks for the reply..

I am aware that there are means for the PLC to communicate with PC, such as using RSlinx or some 3rd party drivers.

However, what I want is a method that does not need RSlinx or other drivers.

I just want the PLC to send a simple text string and to receive the same via TCP/IP. On the PC side, I already have a program to handle that.
 
RSLinx and OPC and the various EtherNet/IP messaging protocols weren't created on a lark, you know. Opening a socket and sending a string does exactly nothing for data integrity, resource management, security, permissions, multiclient management or anything else that PLCs have to do when communicating with external systems.

The current generation of "L7x" based ControlLogix family controllers includes the 'Open Sockets' feature that allows you to "open a socket and send a string" to a PC. This includes the 1756-L7x controllers with 1756-EN2T, -EN2F and -EN3TR Ethernet modules and all of the new 5370 series CompactLogix with their embedded Ethernet daughtercards.

The older controllers (1756-L6x or 1768-L4x) need a special module; the 1756-EWEB or 1768-EWEB.

This is not a very common procedure so the documentation isn't extensive, but there are RA Knowledgebase documents and the User Manuals for those modules that should allow you to use MSG instructions to open and close sockets and send data through them.
 
Thanks for the info. I'm using a 1769-L35E Compactlogic5335E controller. It has a build in Ethernet connectivity. Does this controller allows opening of a socket and send data right thru them?

Actually, I have a device that accepts string commands via TCP/IP and will send the results thru the same connection. The device does not support CIP or EIP or similar industrial protocol to work with a PLC.

If the PLC can send a string like a PC, then, I can setup the PLC to communicate directly with the device and need not go thru the PC.

Hence, I'm looking for the information on how to configure the PLC to open a socket and send a string thru TCPIP.

I refer to the manual and there wasn't any information on how to open a socket and send strings.

Appreciate if there is references on how to do it.

Thanks.
 
This already looks like a bit of a Macgyver solution (and if you don't know who that is, Google it), so hopefully my solution doesn't sound too ridiculous...

I'd buy a little serial to ethernet gateway like the MOXA NPort (http://www.moxa.com/product/NPort_5150.htm) and connect the serial side to your compactLogix's serial port. you can then set up all the complicated Ethernet stuff like ports / IP addresses etc inside the Moxa unit, and read/write ASCII strings using simple ARD & AWT instructions inside the PLC (plus the buffer testing etc instructions... maybe this isn't so easy after all? :p )

Just an idea, and i haven't tried it for this exact type of application myself. I've used the MOXA serial to ethernet converters before in a different application (getting a serial device onto ethernet so we could send data packets to it from a bit of custom software) and they work very nicely.
 
The 1769-L35E does not support "open socket" communications, and you can't connect a 1768-EWEB to it.

Sending a string through a TCP socket is slightly more error-proof than sending a string through a UART, fortunately.

I'm working on an application today where the microcontroller vendor did about what you're doing: No start/end bytes, no CRC, no data length value. You just have to trust that the cable didn't get unplugged in the middle of the transmission and do some limit testing on the values you decode from the string. In my case I'm not even guaranteed delivery of the whole packet like you are with TCP.

There are third-party gateways that will do this sort of translation; In particular I'm thinking about a device from Real Time Automation that will bridge raw TCP to EtherNet/IP.
 
This already looks like a bit of a Macgyver solution (and if you don't know who that is, Google it), so hopefully my solution doesn't sound too ridiculous...

I'd buy a little serial to ethernet gateway like the MOXA NPort (http://www.moxa.com/product/NPort_5150.htm) and connect the serial side to your compactLogix's serial port. you can then set up all the complicated Ethernet stuff like ports / IP addresses etc inside the Moxa unit, and read/write ASCII strings using simple ARD & AWT instructions inside the PLC (plus the buffer testing etc instructions... maybe this isn't so easy after all? :p )

Just an idea, and i haven't tried it for this exact type of application myself. I've used the MOXA serial to ethernet converters before in a different application (getting a serial device onto ethernet so we could send data packets to it from a bit of custom software) and they work very nicely.

Actually, that sounds like a very good solution. I'll keep that one in mind. :)
 
No start/end bytes, no CRC, no data length value. You just have to trust that the cable didn't get unplugged in the middle of the transmission and do some limit testing on the values you decode from the string.

That's a pretty good point in this application - you'd have no error checking what so ever, unless it was built into these "strings" that you're sending.

Hopefully it's a simple command string or something, so you could at least compare it against a list of valid commands and disregard if not.
 
I dont understand why someone would even consider to try and save a nickle on a system for which they have already paid gold.
A complete system based on a Compactlogix will be quite expensive. How much will an RSLinx Single Node license cost compared to that ? 2-3% ?
 
I think the issue is that there is some hardware device (not a PC) that communicates using plain ASCII over a raw TCP connection. RSLinx probably wouldn't work in this case, as he'd still need some software on the PC to receive the connection from the hardware device, translate it, and poke it back out to RSlinx.

If I were the OP, I'd probably be looking to replace this odd hardware device with something that utilizes a common industrial protocol for communication. Of course, it could be a $100k piece of custom machinery... who knows, except the OP.
 
Actually, the serial port is already used for communication between PC and PLC, that's why I can't use it, even thou the device support RS232C.

So, now, a couple of devices communicate with the PC, and the PC act like middle man to pass the data to the PLC.

If the PLC can "talk" directly to the devices via Ethernet, it'll make things much simpler. Everything just plug into the network switch/hub, less messy also.

But I guess it is not possible now.

Anyway, thanks for sharing :)


This already looks like a bit of a Macgyver solution (and if you don't know who that is, Google it), so hopefully my solution doesn't sound too ridiculous...

I'd buy a little serial to ethernet gateway like the MOXA NPort (http://www.moxa.com/product/NPort_5150.htm) and connect the serial side to your compactLogix's serial port. you can then set up all the complicated Ethernet stuff like ports / IP addresses etc inside the Moxa unit, and read/write ASCII strings using simple ARD & AWT instructions inside the PLC (plus the buffer testing etc instructions... maybe this isn't so easy after all? :p )

Just an idea, and i haven't tried it for this exact type of application myself. I've used the MOXA serial to ethernet converters before in a different application (getting a serial device onto ethernet so we could send data packets to it from a bit of custom software) and they work very nicely.
 
saffa.. do you have the settings to hand for the moxa box as i have a Moxa NPort 5110 but crnt seam to get any settings which will communicate with a compactlogix, i crnt even see the compact in RSLinx, maybe it could be the cable i used a CP3 between the moxa and compact.
 
I dont understand why someone would even consider to try and save a nickle on a system for which they have already paid gold.
A complete system based on a Compactlogix will be quite expensive. How much will an RSLinx Single Node license cost compared to that ? 2-3% ?

Getting the company to spring for it is one problem, getting IT to "support" a new application is another, and then you have to add another app to the site's librarian load.

Then there is getting it past Central Engineering (hint: the answer is always "no" unless they came up with the idea).

And if it is a one-off solution, then there is the expense of a site license for one PLC.

Other than that, I can't think of any reason... :)
 
saffa.. do you have the settings to hand for the moxa box as i have a Moxa NPort 5110 but crnt seam to get any settings which will communicate with a compactlogix, i crnt even see the compact in RSLinx, maybe it could be the cable i used a CP3 between the moxa and compact.

Hi Rob,

what you're trying to do is a bit different from the original problem...

what driver are you trying to use in RSlinx? This won't work with the RSlinx ethernet driver - the Moxa is connected to a serial port on your compactlogix and will simply pass all data received through to the serial port. The actual data sent "over the wire" is different if you're using a plain ol' Serial DF1 connection - it's encapsulated within header information etc.

If your sole purpose of using the moxa unit on the serial port of the compactlogix is to be able to go online to the PLC or to expose it to a SCADA system, then i'd use a 1761-NET-ENI rather.

However, you might still be able to make this work by using a Virtual Comm port redirector such as http://www.hw-group.com/products/hw_vsp/index_en.html to expose a virtual com port on your machine which directs to your Moxa. You would then set up RSLinx to use the Serial DF1 interface (RS232 serial devices or whatever it's called, I can't remember off the top of my head).

However, that's a bit of a tacky solution in my opinion and one I haven't tried to do myself.

In the OP's problem, he was sending "raw" data via TCP which would be passed without modification by the Moxa through to his PLC. It'd then be up to him to interpret those raw characters within his processor to decipher what had been sent.
 

Similar Topics

I am trying to establish communication between Siemens PLC 1500 and Matlab. I followed a tutorial on youtube at this link: But when I got to the...
Replies
0
Views
354
Hi all, I don't have experience PLC programming so it might be a stupid question. I made a socket request to PLC and there is no problem to read...
Replies
5
Views
868
Good day Programmers I have a RSTi-EP CPE100 Standalone Controller from Emerson as well as a STXMBE001 (MODBUS TCP/IP) as a Modbus communication...
Replies
0
Views
639
Silly question: I would like to know if anyone has done TCP Socket communication between Logix controllers? I do know it works fine from any...
Replies
6
Views
4,330
Hello Experts, I am building an application in Matlab (on my PC) which has a TCP/IP toolbox to allow me to connect to Ethernet enabled devices...
Replies
2
Views
2,744
Back
Top Bottom