Jump to content

Delay between MODBUS messages


Recommended Posts

Hello guys,

So I am trying use a vision350 to send and receive values to 12 channels of a PID controller through MODBUS. The communication of read holding registers and preset holding register is working well. My question: Is there a way to easily create a small delay between nets. I want 1 modbus FB to run in a image.png.36306d6843ab89f4933e7f437dbdd8a4.pngnet and after a short delay the next net with the next modbus FB. The FB's like in the in the image but with a delay between them.

 

Becouse i've got many slave ID's an easy solution would be nice

Link to comment
Share on other sites

  • MVP 2023

How much delay are you wanting? If it's 10ms or more, then just use a timer.

I'll also point out that the ladder rungs in your post are exhibiting poor form. Refer to the example projects that came with your VisiLogic installation to see how to properly set up MODBUS commands. If you have questions I'll be happy to help.

Link to comment
Share on other sites

  • MVP 2023

If you add any sort of timer to the mix, don't forget to have your logic allow for failed read/writes.  Especially if you have your comms doing multiple attempts.  All your sequencing must follow on from the "modbus busy" controls operating as Flex and Isak are suggesting.  If you don't do this, think about what can happen.  Something might take longer than usual if there's a failure, and if your timer fires off before the current operation is finished all it's attempts, all the logic and triggering steps get out of sync.  Such a scenario can completely disrupt comms if the failure is permanent.  Specific system response controls must trigger your program in a controlled way.

The other way to go is to simply ignore the busy signals etc and allow far more time b/n what will essentially be a consistent time length flipflop regularly switching between your 2 actions.   The flipflop's time innately covers any sort of failure by being longer than the total that could potentially occur.  This works ok if you don't need updating as fast as possible, but you still have to have monitoring of the various status messages to pick up on consistent failures. 

There are myriad ways of doing any of this, all relating to programmer's personal preferences.  Isak says he can bang things in immediately, but I allow a few scans between action finishing and doing the next one, as I get what I think are buffer issues occurring if I don't.  My issues might also relate to how much info is being transferred.  I often do fairly large blocks of registers, with specific locations within the block interpreted by the plc.  If you're just working with one register, things are a lot quicker.  Especially on RTU.

cheers, Aus

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...