Jump to content

Modbus TCP, No Communication


Recommended Posts

I am trying to interface to Factory IO  and I can not read or write anything.

I used the TCP Master config example in the help file for modbus tcp and running a modbus bus monitor shows a connection being made but no actual communications happening.

All code is exactly as shown except I don't close the socket as there is no other slaves to worry about. Anybody know how I should configure a read/write block to pull the virtual IO out of Factory IO?

 

Link to comment
Share on other sites

  • MVP 2023

Client = Master  , Server = Slave.

This is a confusing issue in our world as different people use different terms.

I remember it as a Client is demanding and asks for things, an a Server is humble and gives things away.

Now if we want to get into ways to remember the resistor color code.....

Joe T.

Link to comment
Share on other sites

Yes the who's who naming is confusing but it makes sense that the slave is a server as its "hosting" data. I have tried all configurations and it has not worked, using a modbus master tool I can read/write to Factory IO so I know their system is working but the Samba PLC is just not communicating. It looks like Socket 3 never connects?

 

 

 

modbus_test.vlp

Link to comment
Share on other sites

  • MVP 2023

HI Joe, I NOTE that your Clients are demanding and that you are ever humble and giving things away.  😀

Geeesshhh you Yanks do weird stuff.  Muk A Rownd  wit tha Queeen's English.    Almost as bad as HO calling a download an upload!    But I get your methods of remembering.

cheers, Aus

Link to comment
Share on other sites

23 hours ago, Joe Tauser said:

Try putting a positive transitional you set yourself in series with the Connect logic.

I put a positive transition attached to a button and Socket 3 still never connects, thus not even getting to the modbus r/w mix FB.

I don't understand why it wouldn't work, it as basic of a setup as possible. Will Socket 3 only connect when the slave accepts the TCP connection? As this is running on a Windows 7 machine maybe its a firewall issue?

Link to comment
Share on other sites

  • MVP 2023

I've had a quick squiz over the ladder (after working through the hiccouphs as I still use 9.8.65) and to me some things stand out.

1.  Your socket init is showing as master, so backtracking to my previous notes, make sure the relationships are correct.

2.  Your card init is showing the gateway as the same address as you have in comments for the FCTORY IO.  I don't know the quirks of Factory IO but think this might be an issue if you're not getting a DNS resolution.  Can Factory IO do this, or should you be referencing your router?

3.  For interest's sake, try making the ports the same.  And ensure that Factory IO is set to work on said ports.

cheers, Aus

Link to comment
Share on other sites

18 hours ago, Ausman said:

I've had a quick squiz over the ladder (after working through the hiccouphs as I still use 9.8.65) and to me some things stand out.

1.  Your socket init is showing as master, so backtracking to my previous notes, make sure the relationships are correct.

2.  Your card init is showing the gateway as the same address as you have in comments for the FCTORY IO.  I don't know the quirks of Factory IO but think this might be an issue if you're not getting a DNS resolution.  Can Factory IO do this, or should you be referencing your router?

3.  For interest's sake, try making the ports the same.  And ensure that Factory IO is set to work on said ports.

cheers, Aus

1 - I want the PLC as Master. I have run QModMaster on the same machine as Factory IO and made sure I can interact properly and it works as expected.

2 - The PLC and the laptop running Factory IO are connected with a ethernet cable. No switch or router. Laptop has a static ip of 192.168.1.1. As it is a static network without DHCP there should not be any DNS request at all. I can try the PLC as the gateway though. I have never put a router in a field install, only switches.

3 - Which ports the same? I have the slave configured in the setup block with port 502 and I connect with port 502. I verified Factory IO is communicating on 502 with QModMaster.

Not sure why this isn't working... I can try and get an old router out of the box but it will just be connected to the local LAN switch anyways. Maybe a MDX issue and I need a crossover cable? All switches nowdays are Auto MDX.

Link to comment
Share on other sites

  • MVP 2023

I have never worked with Factory IO and can't do physical trials.  And I am mainly a 485 RTU user.  So this is a bit of a learning curve for me as well, just for interest's sake.

1.  You want the PLC to be master.  I still come back to the setup naming conventions above where it looks like you have Factory IO is a master as well.

2.  OK.  Thought it would be part of a bigger network.

3.  All ports throughout your program.  Inits, etc.

Pls post your latest program, as I am still working on your original and agree with Joe's call on the connect. 

Lastly, and likely the most important observation, to my TCP/IP modbus inexperienced eye you are trying to do things using Calls with wrong naming conventions and means of doing things that are Unitronics unique.   Your R/W mix is still calling the Factory IO as slave, and apart from this error, this procedure I did not think possible other than b/n Unitronics stuff.  You will likely need to break it up into separate calls.

cheers, Aus

Link to comment
Share on other sites

Well I got it working last night! 

It turns out that Windows was the complete failure here. Windows 7 has a bug where if you have 2 networks the firewall settings apply ONLY to the FIRST to connect. The second gets the default config and there is no option to specify interface. The only way to make it work was "Run, service.msc, find Windows Firewall, Stop & Disable".

I knew it couldn't be this hard...

Apparently the slave ID on Modbus TCP is ignored as the IP inherently only points to one device, only RTU checks the ID.

Also the R/W mix I have not tried, I put a standard read inputs FB and it did not work until I figured out the firewall thing. Just for fun when I have more time I will see if R/W mix only works for Unitronics stuff.

Thanks for the help, even though it was Windows all along....!

Link to comment
Share on other sites

  • 3 years later...
On 8/18/2019 at 5:03 PM, Trevor J said:

Well I got it working last night! 

It turns out that Windows was the complete failure here. Windows 7 has a bug where if you have 2 networks the firewall settings apply ONLY to the FIRST to connect. The second gets the default config and there is no option to specify interface. The only way to make it work was "Run, service.msc, find Windows Firewall, Stop & Disable".

I knew it couldn't be this hard...

Apparently the slave ID on Modbus TCP is ignored as the IP inherently only points to one device, only RTU checks the ID.

Also the R/W mix I have not tried, I put a standard read inputs FB and it did not work until I figured out the firewall thing. Just for fun when I have more time I will see if R/W mix only works for Unitronics stuff.

Thanks for the help, even though it was Windows all along....!

Could you send the final file of that code? I’m also trying to connect between samba and factory IO without success. 
 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...