Jacek Posted November 5, 2010 Report Posted November 5, 2010 Modbus TCP problem - the master does not establish the connection (Vision280) As mentioned in the topic, my goal is to establish a Modbus TCP communication between two Vision280 but have some problems. I can do the “slave part†- with proper socket initialization and Scan_EX the PLC responds to Modbus TCP requests sent from a PC with TopServer. However, after hours of trying, I cannot start up the Master device. It seems that the Master does not even send a single datagram in order to establish a connection with the slave device. I would appreciate any kind of help. And this is what I did... Master PLC program: “Card init†with proper IP addresses. “TCP/IP Sock Init†for TCP protocol and “masterâ€. “Modbus IP config†with one slave defined. When: “Card Initialized AND Socket Initialized AND NOT Function in Progress AND NOT Socket Connected†I execute the TCP/IP Connect with proper remote IP and port. Then I have a Modbus IP R.H.R and Close socket but those FBs are never called. Effect: - after successful configuration (anyway, it seems so) the master does not send a single frame. I am sure of that as I connected my PC with point-to-point ethernet cable and used Wireshark to monitor the ethernet communication. Trials: Both PLCs seems to be in order. Both could operate as slaves with no problem (I tested it with TopServer). During configuration I tried different Modbus IDs (also the stupid ones from the point of view of modbus communication network), that is: Master as 255 and Slave as 1, Master as 10 and Slave as 1, Master as 10 and Slave 255, Master and Slave 255. With direct connection of PC and PLC I couldn't detect any kind of PLC activity while invoking the “TCP/IP connect†FB. Even thought the 3 point, I tried the PLC to PLC communication – of course with no success. (“Ping†between the devices was OK). System data I checked: SDW 39 (ethernet general error counters). If I am not very much mistaken (I cannot check it now) the counters were equal 0. SI 145 and SI 147 (those sockets I tried). After socket initialization the state was 14 (UDP ready). It was strange for me because I surly initialized the sockets for TCP protocol. So that part I do not understand... I have to add that it is the first time when I use Unitronics so maybe I do not do some crucial initialization of something. I would appreciate any kind of help of even hints about some more test I could perform. Maybe there are some more status words or error reports which I do not know about. panel_modbus_tcp.vlp
linxchas Posted November 5, 2010 Report Posted November 5, 2010 2 notes: 1. In sub "ModbusTCP master" net 4: Instead SB1 should be SB149 (seems to me just a miss spell) 2. Unitronics will correct me if i am wrong, but ModBus init is recommended to be placed in !Main Routine
linxchas Posted November 5, 2010 Report Posted November 5, 2010 I just looked deeper into your code: All initiate functions have to be 1 scan operation and you set for every scan. The best way is to use SB2 (PowerUp) as a condition
Jacek Posted November 6, 2010 Author Report Posted November 6, 2010 I just looked deeper into your code: All initiate functions have to be 1 scan operation and you set for every scan. The best way is to use SB2 (PowerUp) as a condition Thank you for you replay. I realized that by mistake I have attached wrong PLC project - it was the first version of the program (stupid of me ). Then I cut everything that was not necessary. If you could see the project I attach now I would be really grateful. Here, executing the “connect†FB the PLC does not send a single frame through ethernet communication link. ModbusIPMaster.vlp
Damian Posted November 7, 2010 Report Posted November 7, 2010 Network 2: Split this up into two nets. It is bad practice to have multiple rungs in one net. Try removing the "underscore" from the PLC name (just to rule it out) Regarding SI145, Unitronics has some documentation missing. Status 14 also means initialized to TCP master Maybe better not to make MB5 a set coil. This only allows you to try the connection once. Make sure the Device ID of your slave device is set to 2 (as is in your config block) Try using socket 2. It's defaults more closely match what you are doing. Where is your RHR function??? You should post your Slave code as well. When you are viewing Online are SB142 and SB143 on? 1
linxchas Posted November 7, 2010 Report Posted November 7, 2010 It should work, Some remarks you'll find in the attachment ModbusIPMaster2.vlp 1
Jacek Posted November 17, 2010 Author Report Posted November 17, 2010 It should work, Some remarks you'll find in the attachment Thank you for your help - that really worked. The problem was that i didn't have the CARD INIT and SOCK INIT FB in one rung but in two separate rungs. Strange, because both were executed with "power-up" bit. And not very intuitive... Thanks again
Jacek Posted November 17, 2010 Author Report Posted November 17, 2010 Network 2: Split this up into two nets. It is bad practice to have multiple rungs in one net. Try removing the "underscore" from the PLC name (just to rule it out) Regarding SI145, Unitronics has some documentation missing. Status 14 also means initialized to TCP master Maybe better not to make MB5 a set coil. This only allows you to try the connection once. Make sure the Device ID of your slave device is set to 2 (as is in your config block) Try using socket 2. It's defaults more closely match what you are doing. Where is your RHR function??? You should post your Slave code as well. When you are viewing Online are SB142 and SB143 on? Thank you for your remarks and information about SI145. I've checked that underscore in the plc name doesn't matter. There were no RHR function because i cut everything that was not crucial (anyway in the second plc project i've sent) I appreciate your help
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now