Modbus pooling


effman

Recommended Posts

I have to pool several different modbus RTU devices on single rs485 line. Baud rate is 115200. Pool time must be az short az possible. Is there any possibility to get info about finished modbus transfer? I mean some property to check each 25 ms to make the pooling as fast as possible? Or any other way to avoid delay() between modbus calls?

Thank you in advance for support

Tibor

Link to comment
Share on other sites

You don't really need the delay() between calls as the CPU is released while waiting for a response.  You do need a delay inside any error handling, i.e.:

while(1)
   try
      // read the devices
   catch()
      ? strLastError
      delay(0.1)
   endcatch
endwhile

If you don't then if there is a typo in your code, or some other error, it will get repeated without any CPU release, tying up that CPU and possibly hanging or at least greatly slowing DAQFactory.

A few notes on your app:
1) 115200 is quite susceptible to noise due to the duration of each pulse, so be especially diligent with your shielding and termination
2) there is often required a 10 to 20ms delay in polls when switching between multiple devices on a multidrop system.  This is because the transciever on the first unit will "hold the line" and not allow you to move on.
3) for the above reason, and because DAQFactory is multithreaded, you can get much higher data rates if you put each device on its own RS485 line and then have separate, concurrent running script to poll each device

As to your original question, you can always use the time stamp of your data points to determine throughput.  Or add script to do so using the system clock.

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.