LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus 16 bit to 32 bit conversion for updating values

Solved!
Go to solution

Hello, I am wondering if LabVIEW can process multiple modbus register (2 16 bit) at the same time and update them in the while loop. Attached is the picture is the intended outcome that I desire, that the indicators update in the while loop as the loop executes... In the VI, I am specifying my addresses indexed to the while loop, but I am unable to use initialize array, index array, build array and other functions to get the indicators to update like the vi in the png file. Any ideas on how I could do this? Attached is the VI that I am working on.

DesiredExample.PNG

0 Kudos
Message 1 of 2
(1,778 Views)
Solution
Accepted by topic author kepham

The VI you attached is missing the stuff you show in the picture.

 

Your picture should work just fine.

 

One problem you have is the array is outside the while loop and auto-indexes on it.  So the first two iteration of the while loop you'll get data, (going to the same indicator).  After that, it gets nothing because you've emptied the array.

 

Put your reading code inside a For Loop inside the while loop.

 

This really isn't a Modbus conversion question, but a general understand of LabVIEW dataflow.

 

See attached VI.

 

Do make sure the constant wired into the typecast is set to be a SGL datatype.  I label the constant as such so it is obvious to the programmer.  Also pay attention to the word order that is defined for those registers.   Sometimes the most significant word comes first, sometimes the least significant word.  You may have to swap the order of the wires into the Join Numbers function depending on the way the Modbus device is configured.

 

 

0 Kudos
Message 2 of 2
(1,772 Views)