leineme

502 port error

18 posts in this topic

Hi 
i am trying to connect to omron plc (cj2m ) using modbus tcp/ip , by using the port 502 i  get an error saying that the port can't be reached

is there any method to fix that or change the port number ?

 

thank you 

Share this post


Link to post
Share on other sites

What are you trying to connect with? I get that the Omron PLC is the server ("slave"), but what are you connecting from?

Share this post


Link to post
Share on other sites

hi thank you for the replay 

i am connecting from my pc, i coded this programm in  c# in order to connect to my omron using modbus tcp/ip 

Share this post


Link to post
Share on other sites

OK, I'm not very familiar with Omron, but did you set it up as a ModbusTCP server (your C# code is the client right?)? My guess is that you'll need a little setup in the PLC. Again, I'm not very familiar with Omron, but the CJ2M supports ModbusTCP correct (not just RTU)?

And as a small side note: Since this basically is an Omron question, you might get more help in the Omron section of this forum instead of the HMI & SCADA section.

Share this post


Link to post
Share on other sites

the plc is the client , my code is the master ..my goal is to be able to read from my plc ( a basic scada/him application ) 

-yes , it supports the tcp/ip.

thanks for the beside note , just because it was said that for modbus tcp/ip communication goes throw 502  ...i just don't know where the plc keep telling me (the port can't be reached ) , i even tried others (random ) and can't be reached also 

 

 

thanks a lot 

Share this post


Link to post
Share on other sites

Yes, ModbusTCP uses standard port 502 for communication, so you're good there. If the PLC doesn't respond to any handshakes for 502, you should really check your setup. Many PLC's don't open ports unless you explicitly open them. In other words you must probably configure something in the PLC for it to answer requests.

Share this post


Link to post
Share on other sites

hi , i am sorry i didn't quit catch the meaning of  ( configure something in the plc ? )

i thought that was a direct communication : imean code the connexion function , insert the plc's IP @ and the port  and using the ethernet cable ..voilà ?

Share this post


Link to post
Share on other sites

As said; I don't know about Omron, but other brands you must configure the device to e.g. allow external devices to connect. Normally the function must be "enabled" or similar just to make sure it's safe. I don't think you'll have to do any programming, but most likely you'll have to enable ModbusTCP. In Mitsubishi you can specify to enable or disable, and you can specify which IP(s) to accept connections from, which ports to use etc. etc.

Basically it's the same as opening a specific port and service in your PC's firewall (you don't want to open your PC or PLC to all and everyone by default).

Share this post


Link to post
Share on other sites

This was also asked in the Omron forum, and I replied.  CJ2 talks Ethernet/IP not Modbus/TCP.

Share this post


Link to post
Share on other sites

@kaare_t  oh now i get what you'r saying i will concider that, thank you so much for the answers 

Share this post


Link to post
Share on other sites

 

 

@Crossbow please excuse my ignorance  first isn't modbus tcp/ip  and using ethernet cable  is considered as modbus ethernet ?  i mean using c# i coded using the modbustcp.dll ? and please would you do me a favor and give me the link to that post ?

Share this post


Link to post
Share on other sites

@leineme No, Ethernet/IP is a different industrial protocol, so they won't work together...

Share this post


Link to post
Share on other sites

i am so confused right now , can i send you the code and tell me whart i am trying to do ? 

cause i did implement using modbus TCP /IP  ? 

modbusTCP.cs

Share this post


Link to post
Share on other sites

OK, here's a simple explanation:

ModbusTCP = Protocol 1
Ethernet/IP = Protocol 2

The difference is that ModbusTCP is a completely different protocol than Ethernet/IP (two different protocols). It's like DNS and DHCP. Two completely different protocols serving two different goals. So you cannot use ModbusTCP if your device only supports Ethernet/IP.

So basically DNS != DHCP, and ModbusTCP != Ethernet/IP.

Share this post


Link to post
Share on other sites

oh , no i get that , i was wondering about what exactly the diffrence , i looked in google  , but for  omron cj2m (i've checked it in their documentation )  they do support modbus tcp/ip via ethernet cable 

Share this post


Link to post
Share on other sites

No, they do not.  Omron supports Ethernet/IP.  It's like trying to talk to someone in Frnech who is speaking German.

Show me the document that says they do.

Share this post


Link to post
Share on other sites

Your links are about CP1L, not CJ.  

Someone has written a function block to make a generic Ethernet message that fits the protocol.  There is no internal support for communication via the Modbus TCP protocol.  You can't just send it a Modbus TCP message.  And it's using a CJ1W-ETN21, not the built in Ethernet port.  Read the information at the links you just posted, there is a sample.  

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