Maarten Posted June 24, 2022 Report Share Posted June 24, 2022 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 net 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 Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted June 24, 2022 MVP 2022 Report Share Posted June 24, 2022 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. Quote Link to comment Share on other sites More sharing options...
Isakovic Posted June 24, 2022 Report Share Posted June 24, 2022 As Flex said you should look at examples and mimic the form. From my experiance Modbus runs fine without delay, both TCP and RTU. In Net 1 you can add NC contact for "Modbus busy" bit after MB35 and reset MB35 at the end of net. And do the same for Net 2. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted June 24, 2022 MVP 2022 Report Share Posted June 24, 2022 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.