Trevor J Posted August 14, 2019 Report Share Posted August 14, 2019 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? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted August 14, 2019 MVP 2022 Report Share Posted August 14, 2019 Post your project file and we'll take a look. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted August 14, 2019 MVP 2022 Report Share Posted August 14, 2019 That link you have posted for Factory I/O goes to what it says in big print is a Client, but also says it is a Master setup. That might be your issue. Ensure you do the config properly in Factory I/O for master/client locations. cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted August 15, 2019 MVP 2022 Report Share Posted August 15, 2019 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. Quote Link to comment Share on other sites More sharing options...
Trevor J Posted August 15, 2019 Author Report Share Posted August 15, 2019 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 Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted August 15, 2019 MVP 2022 Report Share Posted August 15, 2019 Don't call the Socket Connect continuously - it's not getting a chance to set the Socket Connected bit before you start the process again. Try putting a positive transitional you set yourself in series with the Connect logic. Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted August 15, 2019 MVP 2022 Report Share Posted August 15, 2019 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 Quote Link to comment Share on other sites More sharing options...
Trevor J Posted August 16, 2019 Author Report Share Posted August 16, 2019 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? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted August 16, 2019 MVP 2022 Report Share Posted August 16, 2019 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 Quote Link to comment Share on other sites More sharing options...
Trevor J Posted August 17, 2019 Author Report Share Posted August 17, 2019 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. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted August 17, 2019 MVP 2022 Report Share Posted August 17, 2019 More later, but perhaps the issue is incorrect ID relationships in the config. You have the plc identified in the config as Network ID 255. Will discuss more tomorrow. cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted August 17, 2019 MVP 2022 Report Share Posted August 17, 2019 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 Quote Link to comment Share on other sites More sharing options...
Trevor J Posted August 18, 2019 Author Report Share Posted August 18, 2019 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....! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted August 18, 2019 MVP 2022 Report Share Posted August 18, 2019 1 hour ago, Trevor J said: Also the R/W mix I have not tried, To my knowledge, Ausman is correct. This function is only applicable when communicating between Unitronics Vision PLCs (doesn't work with UniStream either). Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted August 18, 2019 MVP 2022 Report Share Posted August 18, 2019 Glad you figured it out. I hate computers. Modbus R/W mix is only for PLC->PLC communication. It does not work for external devices. Joe T. Quote Link to comment Share on other sites More sharing options...
TheSwoosh101 Posted August 24, 2022 Report Share Posted August 24, 2022 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. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted August 24, 2022 MVP 2022 Report Share Posted August 24, 2022 21 minutes ago, TheSwoosh101 said: Could you send the final file of that code? There are example projects that came with your VisiLogic installation that will have the code you're looking for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.