effman Posted July 29, 2019 Share Posted July 29, 2019 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 Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted August 2, 2019 Share Posted August 2, 2019 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. 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.