10-31-2011 08:26 AM
So I have just started writing a program to calibrate a gpib hardware device and I need some help with something.
The calibration process requires a mix of computer-controlled commands to set up the equipment and take readings, and manual adjustment of the device itself.
Since the procedure relies on manual adjustment of various parameters, I need to make it so that a boolean button on the front panel will trigger when my voltmeters will take readings and record their data, but I am not sure how to do this when everything is handled in sub.vis.
The attached image shows the basic design format of the top-level .vi (much of the program is missing, but you should get the idea). There is a case structure sitting in a while loop where the user can pick which calibration step he would like to execute, and there is a "Go!" button to start it. The sub.vi is on the inner-most layer, and there is an unwired "Measure!" button as well.
My understanding is that the sub.vi reads the states of all the inputs as it starts to execute, but does not receive a continuous flow of data from those inputs as its execution continues, so I cannot simply wire the "Measure!" button to the sub.vi because it will only read its initial false state.
10-31-2011 08:32 AM
You are correct in terms of the state of the data the VI receives on its inputs. You can, instead of data, pass in a control reference. Then the subVI can access the control and read its value. There's an example that ships with LabVIEW that shows you how to use control references in subVIs. That example uses a graph, but it's the same tomato. However, note that if the control you are dealing with is a Boolean, and its mechanical action is set to latched, then you will not be able to read its Value, since this operation is not allowed for latch-type mechanical action. You can use the switch mechanical action.
In terms of your code and your description, I'm getting the impression that you really should be looking at creating a state machine. Especially since I see a numeric control that is a step#. Application Design Patterns: State Machines