From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-4110 Independent Channel Configuration

I need to configure the PXI-4110 power supply channels independently and from different VI's at different times.  The attached VI demonstrates the problem I have  when trying to do  this.  I get a "invalid VI session" error message on one of the channels.  I also see the resource name showing up as "ProductPwrSupply (2)" and so on, in the drop down configuration list, when run multiple times.  Example code showes how to configure the 3 available channels at ONE time, but not independently at different times.  Can someone please help?
0 Kudos
Message 1 of 5
(3,438 Views)

Hi alyeska,

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).

Jared T.
Download All
Message 2 of 5
(3,415 Views)
 Indeed setting up a functional global to call the instrument handle does the trick.  I have incorporated it accross my VI's and two PXI power boards and it works fine using all 6 channels seperately.  My only remaining problem is how to "elagently" get the functional globals initialized before ANY of the other code tries to read it.  Currently I am accepting two error messages (one for each board functional global initialization) when I start my main VI.  Any suggestions?

Thank you VERY much for your help.
0 Kudos
Message 3 of 5
(3,405 Views)

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.

Jared T.
0 Kudos
Message 4 of 5
(3,391 Views)

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.

CUDOS!

Scientia est potentia!
0 Kudos
Message 5 of 5
(2,989 Views)