PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-4110 current limit

Solved!
Go to solution

I am programming a PXI-4110 with LabWindows. I am trying out the current limiting. I have an output set to 5V with a 1K load resistor; this makes the current 5mA. I set the current limit to 2mA to see it work. When I read the voltage and current it is still 5V and 5mA. Here is my code:

 

g_voltageLevel_ch0 = 5.0;

g_currenLimit_ch0= 2.0e-3;

 

 status = niDCPower_ConfigureOutputFunction(vi_4110_0, channel0Name, NIDCPOWER_VAL_DC_VOLTAGE);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 status = niDCPower_ConfigureSense(vi_4110_0, channel0Name, NIDCPOWER_VAL_LOCAL);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 

 status = niDCPower_ConfigureVoltageLevel(vi_4110_0, channel0Name, g_voltageLevel_ch0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 status = niDCPower_ConfigureCurrentLimit(vi_4110_0, channel0Name, NIDCPOWER_VAL_CURRENT_REGULATE, g_currenLimit_ch0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);

0 Kudos
Message 1 of 13
(4,588 Views)

DPearce,

 

I might suggest starting your testing with one of the NI-DCPOWER examples for LabWindows/CVI found in Start >> Programs >> National Instruments >> DCPower >> examples.

 

Specifically, the NI-DCPower Source DC Voltage example should do what you're looking for.  If you give that a try and still have this problem repost and let me know.  Also, if you could provide how you are confirming the voltage and current readings that would be useful as well.

 

Regards,

National Instruments
0 Kudos
Message 2 of 13
(4,579 Views)

The examples I see are for a Windows operating system. I have a realtime OS on my PXI controller.

0 Kudos
Message 3 of 13
(4,576 Views)

Sorry, I didn't realize you were on an RT system.  

 

Are you able to open just the .c and .h files to take a look at how the code is implemented?  Or does it not allow you to access the files at all?

 

I've attached them here as well.

 

Regards,

National Instruments
Download All
0 Kudos
Message 4 of 13
(4,565 Views)

I'm getting an error now. I have a 1K resistor on each of the outputs so I will see some current.

Look for these lines

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

to see comments I am sending you about the code.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When I start my program I call a function PXI4110_HardwareInit() to get things set up. This part seems to look OK.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/************************************** PXI-4110 ****************************************/
// PXI-4110 hardware definitions for initialization
static ViSession vi_4110_0 = VI_NULL, vi_4110_1 = VI_NULL, vi_4110_2 = VI_NULL;
/* The channel names are length 2 because the maximum size of the strings
from the each textbox on the UI is 1. */
static ViChar channel0Name[2] = "0";  // 0V to 6V channel
static ViChar channel1Name[2] = "1";  // 0V to 20V channel
static ViChar channel2Name[2] = "2";  // 0V to -20V channel

// inputs
ViReal64 g_voltageLevel_ch0 = 5.0;
ViReal64 g_voltageLevel_ch1 = +13.0;
ViReal64 g_voltageLevel_ch2 = -13.0;

ViReal64 g_currenLimit_ch0 = 500.0e-3;
ViReal64 g_currenLimit_ch1 = 500.0e-3;
ViReal64 g_currenLimit_ch2 = 500.0e-3;

/*******************************************************************************************/

 


void PXI4110_HardwareInit(void)
{
 ViStatus status;
 ViChar errorMessage[256];
    ViChar resourceDCSupplyName[256] = "PXI-4110";
 
 // set channel 0 to +5.0V
 status = niDCPower_InitializeWithChannels(resourceDCSupplyName,channel0Name,VI_TRUE,VI_NULL,&vi_4110_0);
 if(status < 0)
 {
  niDCPower_error_message(vi_4110_0, status, errorMessage);
 }
 status = niDCPower_ConfigureOutputFunction(vi_4110_0, channel0Name, NIDCPOWER_VAL_DC_VOLTAGE);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 status = niDCPower_ConfigureSense(vi_4110_0, channel0Name, NIDCPOWER_VAL_LOCAL);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 status = niDCPower_ConfigureCurrentLimitRange(vi_4110_0,channel0Name,  1.0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 

 Set_PXI_4110_Outputs();
 
 status = niDCPower_ConfigureOutputEnabled(vi_4110_0, channel0Name, VI_FALSE);
  
 status = niDCPower_Initiate(vi_4110_0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 }

static void Set_PXI_4110_Outputs(void)
{
 ViStatus status;
 ViChar errorMessage[256];
 
 // channel 0
 status = niDCPower_ConfigureVoltageLevel(vi_4110_0, channel0Name, g_voltageLevel_ch0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);
 status = niDCPower_ConfigureCurrentLimit(vi_4110_0, channel0Name, NIDCPOWER_VAL_CURRENT_REGULATE, g_currenLimit_ch0);
 niDCPower_error_message(vi_4110_0, status, errorMessage);

  
}

 

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Then I send a message on ethernet to enable the outputs: When I enable the outputs this function reads the voltage and current outputs and sends this information to a application on my host computer. This information corresponds to what I set it to and what I see with a volt meter.  

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

void PXI_4110_enable_outputs(void)
{
 ViStatus status;
    ViReal64 measuredVoltage, measuredCurrent;
    ViBoolean inCompliance;
 ViChar errorMessage[256];
 
 // set the outputs
// Set_PXI_4110_Outputs();

 status = niDCPower_ConfigureOutputEnabled(vi_4110_0, channel0Name, VI_TRUE);
      /* Wait for the outputs to settle. */
     Delay(50e-3);
 
  // check channel 0
  status = niDCPower_MeasureMultiple(vi_4110_0, channel0Name, &measuredVoltage, &measuredCurrent);
  niDCPower_error_message(vi_4110_0, status, errorMessage);
  niDCPower_QueryInCompliance(vi_4110_0, channel0Name, &inCompliance);
  niDCPower_error_message(vi_4110_0, status, errorMessage);

 

}

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Now I send a message to change the current limit. This is where I have trouble. I try and limit the current on Channel 0 to 2mA. Since the output voltage is 5Volt and the resistor is 1K the current will exceed the current limit which is what I am trying to test. I get an error in this function>

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

   g_currenLimit_ch0 = CommandData->data; 
   status = niDCPower_ConfigureCurrentLimit(vi_4110_0, channel0Name, NIDCPOWER_VAL_CURRENT_REGULATE, g_currenLimit_ch0);
   niDCPower_error_message(vi_4110_0, status, errorMessage);

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I see g_currentLimit_ch0 = 2e-3 whic is whatI sent. but my status is a negative number. The message is "Invalid value for parameter or property"

vi_4110_0 is the handle I got earlier.

channel0Name ="0"

and g_currentLimit_ch0 = 2e-3

 

I do not understand why I am seeing and error here?????????????????????

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

thanks in advance for your help,

 

Don

 

 

0 Kudos
Message 5 of 13
(4,556 Views)

Don

 

I believe the error may be a typo in the parameter of that function.  "g_currenLimit_ch0" instead of "g_currentLimit_Ch0".

 

Regards,

 

Chris Davis

Applications Engineer

National Instruments

Ni.com/support 

National Instruments
0 Kudos
Message 6 of 13
(4,544 Views)

I do not have a variable named "g_currentLimit_Ch0" in my code. That was only a typo in my comments. Sorry about the confusion.

 

 

0 Kudos
Message 7 of 13
(4,532 Views)

If you look at my post with the code included you will see this :

 

Look for these lines

--------------------------------------------------​--------------------------------------------------​--------------------------------------------------​------------------

to see comments I am sending you about the code.

--------------------------------------------------​--------------------------------------------------​--------------------------------------------------​------------------

 

That means text between these lines:

--------------------------------------------------​--------------------------------------------------​--------------------------------------------------​------------------

Have information describing what I am doing. A message to the post viewer.

 

0 Kudos
Message 8 of 13
(4,529 Views)
Solution
Accepted by topic author DPearce

I am finding that if I set my current limit on channel 0 to 10mA and above the error message goes away. However, I can set the current limit to channels 1 and 2 to 2mA and I do not have an error message with them. I do not see anything in the power supply about a valid range on the current limit. To be clear on what is happening if I do this:

 

   status = niDCPower_ConfigureCurrentLimit(vi_4110_0, channel0Name, NIDCPOWER_VAL_CURRENT_REGULATE, 8e-3);

 

I get the error "Invalid value for parameter or property."

 

However, if I do this:

 status = niDCPower_ConfigureCurrentLimit(vi_4110_0, channel0Name, NIDCPOWER_VAL_CURRENT_REGULATE, 10e-3);

 

I do not get an error.

 

Channels 1 and 2 do not have this limit. I have gone down to 1mA on these channels and no problem.

 

0 Kudos
Message 9 of 13
(4,523 Views)

I see...I recognized your comments but caught the typo in the wrong spot it seems.

 

To your last post: I now see that this makes sense based on the specifications of the 4110.  Any current limit below 10mA will be coerced up for this channel only.  This is specified in the DCPOWER help file: http://digital.ni.com/manuals.nsf/websearch/DDE00844DB6F988986257826007DB0CB .

National Instruments
0 Kudos
Message 10 of 13
(4,508 Views)