Trevor J Posted September 25, 2018 Report Share Posted September 25, 2018 I have two SM43's in my current project with Modbus RTU working. One handles the IO and one is essentially the operator station. I am not sure how to get the communication working reliably. Currently I copy pasted from the examples. So I have an MB set a coil,, the positive transition interlocked with the modbus XIC status calls the modbus function which resets the coil when complete. All fine and dandy and works fine. Now as things get more complex I am sending and receiving several groups of MB & MI's and I want them all to update constantly. I then set the first coil with SB3 and reset/set down the chain to the bottom. This did not really work at all. I then got rid of the SB3 call and made a circular set/reset loop between all the calls. I used an XIC SB2 to set them off and that didn't work great either. What is the best way to get a bunch of modbus commands to run in an endless loop so I can treat both Sambas as if they are one? Link to comment Share on other sites More sharing options...
Isakovic Posted September 25, 2018 Report Share Posted September 25, 2018 Bundle all bits and registers into couple of consecutive registers with struct command, so you can send them all with one Modbus command. Of course, you have to unpack it on the other side. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted September 25, 2018 MVP 2023 Report Share Posted September 25, 2018 Isakovic's suggestion is correct and the best for your current hardware, but you are still working within Modbus limitations. if you really need to get things moving even faster than this, you could put in some Canbus modules and use Unican b/n the two. Much faster and in many ways much easier to do. cheers, Aus. Link to comment Share on other sites More sharing options...
Trevor J Posted September 25, 2018 Author Report Share Posted September 25, 2018 6 hours ago, Isakovic said: Bundle all bits and registers into couple of consecutive registers with struct command, so you can send them all with one Modbus command. Of course, you have to unpack it on the other side. Even if I bundle I will need a few modbus calls for bits and ints. How do I do the logic to get the few function blocks to run back to back and over and over? 24 minutes ago, Ausman said: Isakovic's suggestion is correct and the best for your current hardware, but you are still working within Modbus limitations. if you really need to get things moving even faster than this, you could put in some Canbus modules and use Unican b/n the two. Much faster and in many ways much easier to do. cheers, Aus. I had to go with isolated rs485 due to emi noise and distance issues. I don't need to update the bits every scan but something on the order of 33ms would be great. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted September 25, 2018 MVP 2023 Report Share Posted September 25, 2018 I think you might have trouble achieving your aims sticking with Mbus. Please look at this screenshot of a page from the Unican comms manual. Correctly done it is very fast, noise immune, isolated and can go a fair distance as well. cheers, Aus Link to comment Share on other sites More sharing options...
Trevor J Posted September 26, 2018 Author Report Share Posted September 26, 2018 I got ModBus working properly on my two Sambas. Structs are really useful! Comms is now essentially instantaneous (from the users perspective). I have had some TERRIBLE luck win Can and CanOPEN in the past and have ripped out complete systems and gone to ModBusTCP and it worked right off the bat. My supplier also had the rs485 card on hand so that helped make the decision. In the end as long as it works the protocol is irrelevant. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted September 26, 2018 MVP 2023 Report Share Posted September 26, 2018 It is great that it is working fine. But you need to understand that UniCan is a totally different thing to everything you mention. It is well worth your time having a good look at how it works, to consider possibly using it in the future. 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