03-29-2013 08:03 PM
My test application consists of several VI's. One of them is just for entering/editing test information, e.g. tester's name, date, DUT model names and serial numbers etc. Another is for entering test equipment data (serial numbers, calibration due dates, VISA resourse names etc). Third is for measurement settings (frequencies, power limits, timing, etc). And I have Calibration, Measurement and Reporting VI's which use the entered data.
What's the best way of communicating between these VI's? I use global variables, but every now and then I read in this and other forums that overusing variables is bad practice and should be avoided.
Solved! Go to Solution.
03-29-2013 08:47 PM
The best way is to use wires in cases where the data dependency created by the wires is accepatable. In your case it is not only acceptable beu mandatory. You cannot run the test until the paramters have been entered.
I would suggest a state machine architecture with states which call the various subVIs. The data can be passed on shift registers from one state to the next.
If parallel execution is required for portions of the program, then wiring will not work. A functional global variable or Action Engine may be prefereable to the global variables. Queues are also a good way to pass data to a parallel loop.
Lynn
03-29-2013 09:49 PM
Thank you, Lynn! It seems to me the state machine can be appropriate solution.
03-30-2013 09:10 AM
It wasn't mentioned, but I would recommend grouping all of your parameters into clusters to make wiring from VI to VI a lot easier.
03-30-2013 02:16 PM
Thank you. Yes, I did it, and then saved clusters to Globals.vi.