Sign in to follow this  
Followers 0
papa francisco

ETN21 TCP

26 posts in this topic

I've avoided it too long. I want to learn how to communicate to a PC via an ETN21 using TCP socket communication. I've searched and found examples on opening, sending, rcving, and closing. I have a better tendecny of learning by hands on/trial and error. I was successful downloading and modifying a VB app to read/write to the PLC. This time I want to send and rcv to a server. I figure if I can send a simple message such as ACK and receive a NAK message this would be a good start. From the samples I've downloaded, I'm ready to try. I have two CJ1 cpus and ETN21's. I was thinking if I could write code for both of these, one as a client and the other as server, then I could then connect one of these to a true server for a real app. Undoubtedly it is a rather big bite but I've put it off long enough. Any advice/suggestions? BTW, what is the difference(s) between Modbus TCP and TCP in general? Edited by papa francisco

Share this post


Link to post
Share on other sites
papa francisco Welcome to the forum. I will answer some questions for you, and then ask a few of my own. Your most specific question was the difference between Modbus TCP and TCP in general. (TCP = Transmission Control Protocol). I will simply the answer, so others may disagree with a few points in my explaination. TCP is really more of a delivery protocol, than an actual communications protocol. TCP is the mechanism by which 2 devices connect to each other, to be able to pass messages back and forth. The data that is passed back and forth once the connection is established is really the communications protocol. Examples: Modbus TCP. This is actually a communications protocol used over a TCP connection. It is referred to as 'Modbus TCP' so that it is not confused with the other Modbus protocols such as Modbus RTU, Modbus ASCII, or Modbus Plus. Modbus TCP is basically the Modbus protocol on TCP. FINS TCP. This is the Omron FINS protocol over a TCP connection. Another popular communications delivery protocol is UDP. (UDP = User Datagram Protocol). UDP does not use a 'connection' between 2 devices. It is much more like RS232 comms for Ethernet, where a device sends a message to another device, without knowing that the device is connected on Ethernet. The software application must look for a response from the device to know that the message was delivered. Typical Omron Ethernet communications are done on UDP, not TCP, as the FINS protocol looks for a response from the PLC. There is also FINS TCP, but from my experience, it is used less often. Now a few questions. If your ultimate goal is to communicate to Omron PLCs on Ethernet, you would be much better off using the FINS protocol, that way you only need to write the PC part of the communications. If you use Socket Services in the PLC, then you need to write the ladder code to do the socket services, and handle the protocol (that you create) in ladder. In the world of Omron, Socket Services are normally only used to communicate to devices that do not use the FINS protocol. I have use Socket Services to communicate with bar code readers, torque wrenches, and other devices that have no way of using the FINS protocol. So my question to you is: are you trying to learn TCP communications, or how to communicate to Omron PLCs? The answer to this will help us to steer you in the right direction.

Share this post


Link to post
Share on other sites
Thanks for the response. Eventually I will be communicating to a non FINS protocol app that is already written. I already know what I must send and already know what will be sent. Previously I modified a VB app that reads and writes to DM registers (used the Eternet_UDP app in the download section as the basis) and then added serial comms to write to a LED display. For this learning session I downloaded a file Modbus_TCP_FB.cxp from the forum that uses FB's (good stuff). At this time I only want to write ACK to an IP address and then listen for a response of NAK. I think I have a VB app that will be the server and respond as necessary. I believe when I cross this hurdle I will be able to expand. My confusion is the Modbus TCP. With the exception of the nmae is it just a general TCP or does use a special protocol? I have attached the CXP file that I will attempt to use. Again thanks for the response. Modbus_TCP_FB.cxp

Share this post


Link to post
Share on other sites
papa francisco Good luck on your project. I like your 'can do' attitude! Modbus TCP does use the Modbus protocol, wrapped up in TCP.

Share this post


Link to post
Share on other sites
Are all the TCP FB's in CX programmer the Modbus TCP's or are registers added to customize the TCP to a Modbus TCP?

Share this post


Link to post
Share on other sites
The FBs used are generic TCP FBs for opening, closing, sending, and receiving. The only thing that really makes this Modbus TCP is the data that is sent in D200 - D205, and the port number used on the remote node (port 502). Basically, to do Modbus TCP, you establish a connection to port 502 on TCP, then start sending Modbus commands (with a few other items like MBAP Header).

Share this post


Link to post
Share on other sites
Hi everyone I'm trying to learn how to comunicate with omron plc's throw ethernet, now i'm using an CP1L with a CP1W-CIF41 ethernet board, but i'm not having success. I think that the comunication protocol with the CP1L is the same as the CJ1. Does anyone know were i can find some detailed explanation on how to comunicate with plc's, and some vb application, so i can explore this issues. Thanks

Share this post


Link to post
Share on other sites
The CP1W-CIF41 does support FINS like as with other Ethernet units, but the frame length is limited to about 1000 bytes I believe as opposed to "standard" FINS which is about 2000 bytes. The CIF41 does not support raw TCP comms using socket services. Check the download section, there are a few VB apps and source code using FINS, but I guess you will have to modify the frame to fit CIF41 standard. Have you studied some manuals, like the CP1L operation manual. I uploaded a copy for you, see section 9 which covers the CIF41. W462-E1-06 CP1L Operation Manual @ MrPLC.com

Share this post


Link to post
Share on other sites
I have downloaded some examples and i have tried, but i don't get any answear. I only get one answear when i get connected. Can you, please build one simple FINs instruction to read word CIO0000, with 1 word of leght, from a remote IP 192.168.250.1, with node number 1, and a local IP 192.168.250.128, with node number 128. Mean while i will keep trying Thanks

Share this post


Link to post
Share on other sites
Can anyone check if my configurations in the CIF41 are correct: thanks

Share this post


Link to post
Share on other sites
A few things to change to start out simple. In Picture # 1, change the FINS/UDP option to Destination IP address is changed dynamically. In Picture # 1, uncheck Use FINS/TCP Protection Function. In Picture # 2, delete any and all items in the IP Address table. If a node is on the same first 3 octets (192.168.250), you do not need to list it here. In Picture # 3, delete any and all items in the IP Router table. Unless you are accessing FINS nodes on other segments, you do not need this. In Picture # 4, delete the FINS/TCP Server settings. These would be connections from this PLC to other PLCs via FINS TCP. You should not need this.

Share this post


Link to post
Share on other sites
Hello With this configurations i get the error led form the CIF41 blinking. I get the error code: 021A, and the detail code: 0004 Any ideas of what is wrong? Thanks Edited by SergioFer

Share this post


Link to post
Share on other sites
Yes. You are not reading the manual.

Share this post


Link to post
Share on other sites
In the manual, it says this error is an device configuration error, but i don't know what is wrong in the configuration. In the CIF41 i have made the changes that PMCR sugest, and i think i have to made some configuration in CX-Programmer but i can't find where? In the CJ1, i have and devide configuration, but in the CP1L i can't find that? I haven't used too much the Omron PLC's, and i have never used FINS Comunication. I have tried to connect with CX-Programmer to the PLC useng Fins Ethernet, and it works. Thanks for all

Share this post


Link to post
Share on other sites
The Web Interface of the CIF41 is obviously different from ETN21. In the IP Address and IP Router tables, you can only see one line at a time. Try going through each 'line' one at a time to see if you have anything setup. Click '01', and then Show. If there is an entry, delete it. Click '02', and then Show. If there is an entry, delete it. Click '03', and then Show. If there is an entry, delete it. ....

Share this post


Link to post
Share on other sites
I have already delete all this items, and after this, the error Led from the CIF41 starts flashing, and i don't know what else is wrong in the configuration. I have tested, and with the the configuration that i post before i don't get any error. My question is if i have to do some configuration in the plc for this board? Because i don't find any place to do this, and in the manual, i don't find any description about this. I only find place to configure serial interface port 1 and 2. Wiht the CX-Programmer i get connection, even with the Error led Flashing, but in the vb application i can't get connected, but i used to get connected with the configuration posted before. Any idea? Does anyone ever used this configuration before and get it working? Thanks for everything

Share this post


Link to post
Share on other sites
After a few more tests, i realise that if i put again the configuration of the screen 4 that i posted before, the error goes away. According to PMCR this shouldent be necessary, because i won't connect any other plc throw FIns TCP. Anyone have any ideas?

Share this post


Link to post
Share on other sites
Do i have to do some configuration with CX-integrator? If so how i do that, i've never used before. Any example, please Thanks

Share this post


Link to post
Share on other sites
Hello I can't find a solution, can you please give me some guide lines so i can explore a bit more? Thanks

Share this post


Link to post
Share on other sites
CX Integrator is not required for this module. I have successfully setup a CIF41 using 192.168.250.1 as you have shown, and I have no errors. I still believe that it is a setup problem in the module. Can you capture a screen shot of the DM area for this module? It should be D32000 - D32299 or D32300 - D32599.

Share this post


Link to post
Share on other sites
Thanks for the interest Here is the DM screen shot

Share this post


Link to post
Share on other sites
Looking at the DM Addresses, you still have 2 entries in the IP Address table, and 3 entries in the IP Router table. Remove these entries, and I believe the errors LED will go away.

Share this post


Link to post
Share on other sites
According to the user manual the CP1L-40M uses de DM32000, so here it is the DM table Is this one correct ?? Should i have FFFF or 0000 in the empty words Thanks

Share this post


Link to post
Share on other sites
The module will write FFFF to unused entries. You do not write these in the DM area. You need to remove them via the web interface.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0