LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure current from PXI 4110 Power Supply

When I try to measure voltage and current from a PXI 4110 triple-output power supply, the unit resets the output to zero. What is the correct way to do this?  Here's the code I'm using to turn on the supply, and subsequently measure its output:
 
// Turn on PXI 4110 output to voltage and current limit specified.
void PowerOn(ViReal64 voltLevel, ViReal64 currLimit)
{
niDCPower_init(resourceName, VI_FALSE, VI_FALSE, &vi); // Initialize the session
niDCPower_ConfigureVoltageLevel(vi, channelName, voltLevel); // Configure the voltage level
niDCPower_ConfigureCurrentLimit(vi, channelName, NIDCPOWER_VAL_CURRENT_REGULATE, currLimit); // Configure the current limit
niDCPower_ConfigureOutputEnabled(vi, channelName, VI_TRUE); // Enable the output
if (vi != VI_NULL) niDCPower_close (vi);
}
 
 
// Measure PXI-4110 6V channel Voltage and Current
// this routine does not work.  It turns off the power when run.
PowerMeasure (ViReal64 * voltReadPntr, ViReal64 * currReadPntr)
{
niDCPower_init(resourceName, VI_FALSE, VI_FALSE, &vi);   // Initialize the session
niDCPower_Measure (vi, channelName, NIDCPOWER_VAL_MEASURE_CURRENT,
  currReadPntr);  //measure current, amps
      
niDCPower_Measure (vi, channelName, NIDCPOWER_VAL_MEASURE_VOLTAGE,
  voltReadPntr);  // measure voltage 
 
if (vi != VI_NULL) niDCPower_close (vi);
}
0 Kudos
Message 1 of 2
(3,402 Views)

It is probably caused by the repeated niDCPower_init() and niDCPower_close() function calls that you make. You should only use one niDCPower_init(), at the start of you program, and one niDCPower_close(), at the end. The session handle vi should be global to all your functions that talk to the driver - there is no problem in maintaining this value throughout the entire duration of your program.

 JR

Message 2 of 2
(3,389 Views)