Modbus pooling

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


Share this post

Link to post
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.:

      // read the devices
      ? strLastError

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.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now