Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI 4302 using .Net CreateCurrentChannel to capture 4 to 20mA input

I am using a C# application to capture 4 to 20 mA from a sensor, previously I successfully used a cDAQ 9208 card, I have now switched to PXI 4302 card with 4302C terminal Block.

The application creates a virtual channel using the following code:

myTask.AIChannels.CreateCurrentChannel(physicalChannelComboBox.Text,"",
(AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
Convert.ToDouble(maximumValueNumeric.Value), AICurrentUnits.Amps);

This causes an exception, stating 'CurrentShuntResistance Requested Value 249.0 Possible Values 5.0'

However the call is for an internal shunt resistor, and you do not need to specify a value; if I specify a value I get an error complaining about shunt resistor location being incorrect, it expects an internal shunt resistor.

Is this the correct command for a 4302 card to read input current? Could this be a configuration issue?

I have used an NI example application, 'ContAcq0_20mACurrentSamples...', which gives the same error as my code.

Error messages are attached.

Regards. Dave.

Download All
0 Kudos
Message 1 of 2
(2,225 Views)

I have tried to set the property CurrentShuntLacation and CurrentShuntResistance after the call to CreatCurrentChannel:

 

myTask.AIChannels.CreateCurrentChannel(physicalChannelComboBox.Text,"",
(AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
Convert.ToDouble(maximumValueNumeric.Value), AICurrentUnits.Amps);

// set shunt resistor property
myTask.AIChannels.All.CurrentShuntLocation = AICurrentShuntLocation.Internal;
myTask.AIChannels.All.CurrentShuntResistance = 5;

 

This had no effect, I still get the error that the requested value for shunt resistance is 249.0, which appears to be the default value for an "External" virtual channel.

I can use MAX to create a Task and read current from the PXIe4302 card, and I can use a cDAQ 9208 card with the above command.

Regards

Dave

0 Kudos
Message 2 of 2
(2,186 Views)