LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to chose which shared variables to read

Solved!
Go to solution

I'm trying to clean up some code and I'm looking for style advice. The following code actually works as desired, but I'm wondering if there is a more elegant way to do it.

 

I have a number of shared variables being read from Modbus devices. The problem is that these can be turned off depending on needs. When the device is off, any vi attempting to read that shared variable waits for a time out, then gives an error.

 

What I have done is to put each read operation in a case structure and then have an array of booleans to say which ones are turned on (see screen shot). This works just fine, but I wonder if there is a better way to do this?

 

thanks,

mike

0 Kudos
Message 1 of 2
(2,206 Views)
Solution
Accepted by topic author mooseo

Replace all index arrays and cases with a single For loop and use 'i' connected to a case to choose which variable to read.

 

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 2
(2,193 Views)