I took a look at your code and it appears that there were two sets of configuration VIs trying to access the same instrument handle for the PXI-4110. Every device has a single instrument handle that can be accessed. You can configure the channels independently in your program at anytime as long the configuration VIs reference the same instrument handle. If you do not want to pass the instrument handle directly by wiring it to the various VIs and SubVIs that your program may have, you can setup a functional global to call the instrument handle reference as needed.
The attached example (NI-DCPower Update.vi) uses a functional global (GlobalReference.vi) to pass the reference to the instrument handle to a SubVI that configures the channel (TurnOn.vi).
The best option to force data flow (in other words to force execution order) is to have a wire running between the various sections of code. Usually, the use of error wires is the best way to do this because it serves two purposes: 1) Handle errors that occur and 2) Direct data flow. Error handling is a great programming practice.
Another solid choice would be the use of a state machine architecture to develop your code. The first state could be an “initialize” state, which then flows into other states such as “run,” “wait,” “acquire data,” etc… LabVIEW includes several templates to assist in developing a state machine architecture.
That being said, one option to “force” the functional global to be initialized before any other code is run might be to use a flat or stacked sequence structure. For the case of the stacked sequence structure, the initialization steps could be in the first frame, and the rest of your code could be placed in the second frame. An example of this type of implementation is attached.
This is exactly what i needed. Thank you.
I wish this was part of the documentation or the official examples! it would save a lot of time and frustration.