Jump to content

Modbus logic issues


Recommended Posts

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

  • MVP 2023

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

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

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

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...