AlexV Posted March 2, 2020 Report Share Posted March 2, 2020 Hello, I'm having an issue with the modbus communication over TCP. I can start and connect with the device without problems but at the time I try to get more than 1 value, the program asks the first request, gets a response and jumps to another device without asking the other requests. In segment 5 at start, I've the start contact (MB26) and the realimentation from the last device (MB121). At the end of the same segment i have the activation of segment 6 and the desactivation of the segment 5. The VisiLogic PLC I'm using is a V1210 model. Please find some images attached showing the problem. Thanks, Alex Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted March 2, 2020 MVP 2023 Report Share Posted March 2, 2020 Add a delay timer. You are trying to do the second read on the very next PLC cycle. Perhaps the MODBUS slave cannot respond to multiple requests that quickly. Try giving it a 100ms or so between reads. Link to comment Share on other sites More sharing options...
AlexV Posted March 2, 2020 Author Report Share Posted March 2, 2020 6 hours ago, Flex727 said: Add a delay timer. You are trying to do the second read on the very next PLC cycle. Perhaps the MODBUS slave cannot respond to multiple requests that quickly. Try giving it a 100ms or so between reads. I've tryied to add a 3 sec delay and after a 5 sec delay and I have the same problem. Tried with the SB3 and I have the same problem as the delays. I have tryed to add a counter to control the requests from the modbus but counter do not increment with SB3 pulse. The subroutine is loaded in the main routine. Something strange happens. Any idea? Thank you, Alex, Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted March 2, 2020 MVP 2023 Report Share Posted March 2, 2020 EDIT Ignore this one....Flex's next answer alerted me that I had missed the length of vector, even though I looked carefully!) Please explain MI 2507 in rung 6. Should this perhaps be 2506? But do answer this one......How are you transitioning all your calls? cheers, Aus Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted March 2, 2020 MVP 2023 Report Share Posted March 2, 2020 It looks like you're trying to read two vectors each of length 2 in two separate reads. The two vectors are only 8 registers apart. Why not simplify by reading it as a single vector of length 12? Block out MI 2508 through MI 2515 as "Do Not Use" and move your current use of MI 2508 - MI 2509 to MI 2516 - MI 2517. Link to comment Share on other sites More sharing options...
AlexV Posted March 4, 2020 Author Report Share Posted March 4, 2020 On 3/2/2020 at 10:04 PM, Ausman said: EDIT Ignore this one....Flex's next answer alerted me that I had missed the length of vector, even though I looked carefully!) Please explain MI 2507 in rung 6. Should this perhaps be 2506? But do answer this one......How are you transitioning all your calls? cheers, Aus Hello Aus, The device I'm reading holds values in 2 registers. The value I want it's always placed on the second register so that's the reason I pick the MI 2507 instead MI 2506. I use a set/reset cycle for the serial comunication. Cheers, Alex Link to comment Share on other sites More sharing options...
AlexV Posted March 4, 2020 Author Report Share Posted March 4, 2020 On 3/2/2020 at 10:20 PM, Flex727 said: It looks like you're trying to read two vectors each of length 2 in two separate reads. The two vectors are only 8 registers apart. Why not simplify by reading it as a single vector of length 12? Block out MI 2508 through MI 2515 as "Do Not Use" and move your current use of MI 2508 - MI 2509 to MI 2516 - MI 2517. Hello, I've done what you say and now reading a longer vector I can read the values without problems. Thank you! Which is the max number I can put in a vector lengh? Cheers, Alex Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted March 4, 2020 MVP 2023 Report Share Posted March 4, 2020 4 hours ago, AlexV said: Which is the max number I can put in a vector lengh? 123 for MODBUS TCP (16-bit holding registers). Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted March 4, 2020 MVP 2023 Report Share Posted March 4, 2020 OK on all of that AlexV. You might want to also have a look at this entire thread, just for some other tips and ideas that you might find useful. cheers, Aus 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