LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DCPower Driver for PXI-4110 & PXIe-4145

I am trying to write a driver using the DCPower API that I can call as a sub-vi to a main test application. I would like the sub-vi to be able to have seperate functions that I can call when I need to within my larger application. The thought is to load the main application and when ready call the sub-vi to apply sourced V or sourced I to an output of a attached DCPower PXI instrument. I would then return to my main application, run some more unrelated tests with power supply output still on, then later on call the sub-vi again to be able to take a measurement, return to my main application to run some more tests, then when all done call the sub-vi again to be able to shut off the power outputs.

 

Attached is my VI. I can call the Source V or Source I functions to enable the output but unfortunately when I call Measure V&I it seems to shut down the output. I assume this is because from what I read about the Initialize API function it returns the instrument to the Uncommited (reset) state. I need to call initialize during the Measure V&I function so it opens a handle to the instrument but it then kills the running session.

 

So how can I change this VI to allow me to run the Source functions first, exit sub-vi back to main to run more tests, call sub-vi again to Measure V&I? 

 

Thanks,

Aaron B. 

0 Kudos
Message 1 of 4
(3,443 Views)

Hey aaronb, 

 

I think you'll need to rewrite your VI in a way that doesn't open and close the session with each function. You could add two more functions, Initialize and Close and then output the Instrument IO reference to your main program. You can then take out the initialize/close in each of your other functions. Now, the main program will need to manage the Instrument IO reference in each iteration of your loop (feedback node is a possibility) and pass it into your driver whenever you need to call your measure functions. 

 

Another approach would be to have the initialization and close done outside of your main loop. If you look at the eample vi NI-DCPower Software-Timed Voltage Sweep.vi it is kind of like this. Where you initialize the session and setup the instrument before the main loop. Then you maintain the reference to the instrument using a feedback node and call your functions. Once complete, you close the session.

dcpowerexample.PNG

 

Tim A.
0 Kudos
Message 2 of 4
(3,401 Views)

Yea I thought about having seperate Open/Close handle functions and passing the reference in a Functional Global Variable. However, I was trying to avoid having to pass the reference out because it would likely be very messy. During my main application I will be using multiple channels of two cards PXIe-4145 & PXI-4110 with each channel having different source voltage & source current levels. There has to be a better way to do this.

0 Kudos
Message 3 of 4
(3,394 Views)

I'm not entirely sure how your main program is structured but if its contained in mostly one large loop, I like the cluster approach. Store all of your references and shared data in a single cluster that you store in a shift register. Pass that cluster around and only unbundle what you need when you need it. 

 

cluster example.PNG

 

Would an approach like this be suitable? If not, what do you need that it is missing?

 

 

 

Tim A.
0 Kudos
Message 4 of 4
(3,389 Views)