Jump to content

Trouble with Modbus TCP. The cycle do not perform correctly


Recommended Posts

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

ModbusTCP.JPG

Link to comment
Share on other sites

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

  • MVP 2023

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

  • MVP 2023

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.