LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RTU rate

I recently bought a cheap Modbus digital and analog I/O module, which I poll with a simple loop with the read and write commands (from the Modbus library) in a sequence structure. Depending on the number of modbus commands I put in the sequence, I can get the loop to run at about 10 Hz maximum. 

 

I'm a novice to Modbus and Labview and am interested to know if there is any way to increase the speed that I communicate with the device. I have already increased the baud rate to the maximum supported.

 

The IO module I'm using is Modbus RTU and I wonder if TCP devices are generally faster - although I appreciate this could be very device specific.

 

0 Kudos
Message 1 of 6
(1,875 Views)

Hi Mylonit,

 


@Mylonit wrote:

The IO module I'm using is Modbus RTU and I wonder if TCP devices are generally faster - although I appreciate this could be very device specific.


By stating that insight you should also state the specific type of your device or even provide its manual…

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,855 Views)

@Mylonit wrote:

I recently bought a cheap Modbus digital and analog I/O module, which I poll with a simple loop with the read and write commands (from the Modbus library) in a sequence structure. Depending on the number of modbus commands I put in the sequence, I can get the loop to run at about 10 Hz maximum. 

 

I'm a novice to Modbus and Labview and am interested to know if there is any way to increase the speed that I communicate with the device. I have already increased the baud rate to the maximum supported.

 

The IO module I'm using is Modbus RTU and I wonder if TCP devices are generally faster - although I appreciate this could be very device specific.

 


Yes, no. Maybe...

 

What is the maximum baud rate you device can use?

 

I did a project with 12 watt meters using Modbus RTU at 57600 baud. I was requesting 5 multi-register reads from all 12 devices in a loop and getting a little less than 1 second update rate.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(1,842 Views)

It also depends on what the addresses are fo the registers you want to read.  Suppose you want to read two different registers but they are a few addresses apart.  It is most likely faster to read multiple registers, even ones in between that you don't care about in a single read, than it is to make two separate read requests of individual registers.

0 Kudos
Message 4 of 6
(1,825 Views)

As mentioned before, a lot of the timing is device dependent. That being said, you generally get better comms performance by reading contiguous registers with the Modbus VIs that read multiple registers at once (e.g., Read Multiple Holding Registers) and then splitting the registers into their respective values than you do from performing a bunch of sequential Reads of single registers.

 

For example, if you want to read registers 40001-40021 you are better off using the Read Multiple Holding Registers with a length of 20 registers starting at address 40001 than you are to do 20 individual register reads. I also usually get better performance by doing a single Read Multiple if the registers I want are close together (e.g., if I wanted registers 40001, 40002, 40006, 40008, 40010 I would do a Read Multiple starting at 40001 with a length of 9 and then pull out the particular ones I want with an Index Array, as opposed to doing 5 individual Reads).

0 Kudos
Message 5 of 6
(1,821 Views)

You should also share your code and show screenshots of how you measure the rate and what you get.

 

One example of how this could be relevant lies in your "which I poll with a simple loop with the read and write commands (from the Modbus library)" quote. If this is the old NI Modbus library, for example, it has built-in delays for each serial read, which limit the rate you can achieve. Sharing the code would allow people to be on the same page with you.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(1,808 Views)