sasdiscos Posted June 9, 2018 Report Share Posted June 9, 2018 Hi guys and gals, I have 2 controllers running modbus working perfectly, i need to add another master but for the life of me can't get it working, I currently run the slave and 1st master on socket 3 port 502 over tcp/ip. I set up a second config rung and assigned it to port 503 on socket 2, have the scan ex on both sockets in the slave and just one on each of the masters. Cant get the second master to take to the slave over socket two. Its frustrating the hell out of me. Any one point me in the right direction??? Many thanks in advance, Steve Link to comment Share on other sites More sharing options...
sasdiscos Posted June 9, 2018 Author Report Share Posted June 9, 2018 removed Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted June 10, 2018 MVP 2023 Report Share Posted June 10, 2018 Don't feel bad. TCP communications confuses me too sometimes. Thanks for posting your code! Remember that the port number assigned to a socket is a local thing. The remote device doesn't care about whichever master's port numbers, but it has it's own socket and port number that you have to keep track of. You don't need anything in front of the SCAN_EX block other than a normally closed of SB2. It's just there to listen. You've got a bit re-initializing the Modbus config blocks every time the socket disconnects. Don't do this, as it makes the communications hiccup. You're also triggering MB 60 "Request to Send" here. Trigger it with MB 509 and SB 2 instead. You have a ton of Modbus Read and Write blocks in the Master. This is an excellent application for the Unitronics special Modbus Mixed Read/Write function block. It works quite well - look into it and your code will be much simpler. So here's what you have: The slave addresses in the config block are different. You may just have a typo. Master 1 - (.200) - talking to slave (.208) on Socket 3(M) assigned local port 502. slave port 502. Master 2 - (.124) - talking to slave (.108) on Socket 2(M) assigned local port 2000, slave port 2000. Slave - (.208) - Socket 3(S) local port 502, Socket 2(S) local port 2000. I changed the slave address on the programs I uploaded. So this may very well work as modified. I always make a communication map like this on paper when more than one device is involved. Remembering TCP details is hard. Joe T. Link to comment Share on other sites More sharing options...
sasdiscos Posted June 10, 2018 Author Report Share Posted June 10, 2018 Joe, I can't believe I missed the fact that I had put 108 instead of 208. Grrrrrrrr! You are a top man, many many thanks for your help, It just shows a fresh pair of eyes can sometimes point out what is smacking you in the face! Its working spot on. I owe you a beer! Steve Link to comment Share on other sites More sharing options...
sasdiscos Posted June 14, 2018 Author Report Share Posted June 14, 2018 Please can my programmes be removed from public view/download? Many thanks, Steve Link to comment Share on other sites More sharing options...
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