Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Certain linear scale values result in error

I'm trying to do a simple write of a scaled value to an AOChannel. Here is the code:

using (Task biasChWriteTask = new Task("BiasChWrite"))
{
double min, max;
LinearScale s = (LinearScale) DaqSystem.Local.LoadScale("AmplifierCalibration1");
min = s.Slope * -10.0 + s.YIntercept;
max = s.Slope * 10.0 + s.YIntercept;
AOChannel ao1 = biasChWriteTask.AOChannels.CreateVoltageChannel("/Dev1/ao1", "aoChannel1", min, max, "AmplifierCalibration1");
AnalogSingleChannelWriter w = new AnalogSingleChannelWriter(biasChWriteTask.Stream);
w.WriteSingleSample(true, lowV);
}

I've created the "AmplifierCalibration1" scale in NI-Max. My problem is that certain values of the scale result in a generic DAQmx error (50150) regardless of the value of the voltage I'm trying to write. For instance, (Slope, Y-Intercept) = (25,-5) results in the error, while (25,-10) works fine. Does anyone have any ideas of what could be causing this?

Thanks,
Michael
0 Kudos
Message 1 of 6
(4,197 Views)
Hi Michael,

The -50150 error with DAQ usually indicates an out-of-range error. I do have a few questions:

1) What voltage values are you actually calculating and trying to send to the DAQ driver?

2) Which function is returning the error?

3) What DAQ board are you using?

4) What version of NI-DAQ are you using?

This should be able to help us narrow down the cause of the error.

Thank you,
0 Kudos
Message 2 of 6
(4,184 Views)
Thank you for replying Michael. Here is the additional information.

>> 1) What voltage values are you actually calculating and trying to send to the DAQ driver?
My amplifier outputs +/- 220V, but for my test case I set the variable double lowV (see fcn. below) to 0.0, then varied the MAX scale values to try to find a pattern to the errors. Here is a sample of some of the scale values that I tried and their results:

(Slope, Y-Intercept)
(25,0) -> OK
(25,1) -> Error
(25,-1) -> Error
(25,-5) -> Error
(25,-10)-> OK
(25,0.01)-> Error
(25,0.02)-> OK
(25,0.1) -> OK
(5,0.01) -> Error
(5,0.1) -> Error


>> 2) Which function is returning the error?
w.WriteSingleSample(true, lowV);

>> 3) What DAQ board are you using?
PCI-6221

>> 4) What version of NI-DAQ are you using?
NI-DAQmx 7.4
0 Kudos
Message 3 of 6
(4,181 Views)
Hi Michael,

The "min" and "max" parameters that you are trying to set in the biasChWriteTask.AOChannels.CreateVoltageChannel() function are actually trying to set the ADC gain of the DAQ card itself. This parameter is used for analog input to set the optimal range of the ADC. For the PCI-6221, the legal gain values are +- 10, 5, 1, and 0.2 V. The analog output DAC has a fixed gain of +- 10 V. This can be found in the data sheet on the product website:

http://sine.ni.com/nips/cds/view/p/lang/en/nid/14132

For your analog output application, the min and max parameters should not be changed from the default setting of +- 10 V.

Search for "Limit Settings" in NI-DAQmx Help file.
0 Kudos
Message 4 of 6
(4,156 Views)

Certain linear scaling values on analog input in NI-DAQmx result in static (unchanging) data.

I'm using LabVIEW 8.2 with the latest version of DAQmx. The hardware is a PCIe-6251 multifunctional DAQ board with SCC-68 connector block.

I'm connecting four 0-5 V signals to the board and reading continuously at 1 Hz from each of the 4 analog input channels.

I want to apply 3 different sets of linear scaling factors to the analog input data (in the DAQmx linear scale function) to obtain relevant values (I'm reading off 2 4-20 mA current loop signaling transducers for k-type thermocouples (Omega STCTX-K1) and 2 4-20 mA current loop signaling transducers for RTDs (Omega SPRTX-M1) with analog input for each sensor hooked into the top of a 250 Ohm resistor in the current loop). I believe this information may be irrelevant, because the error seems to be in the software.

For example, I'm reading good data when I apply linear scaling factors

m = 77.39 (slope)

b = -175.73 (Y int)

to any of the channels (and even getting relevant values when I apply these scaling factors to the RTD output).

However, when I apply

m = 35.13

b = - 52.75

There is a single reading that holds throughout the data acquisition, even though the voltage at the analog input is changing (I confirmed this with a digital multimeter).

I tried some different values. For example

m = 35.13

b = -175.73

works, but

m = 77.39

b = -175.73

doesn't. There seems to be an error when the y intercept (b) is not negative enough. Doesn't this sound like a software error? I don't think that changing the linear scaling is changing anything in the hardware, or is it? If so, can you recommend a way to split the dynamic data (containing analog input values from four channels) in the LabVIEW VI so that I can scale each stream of values independantly and rejoin the values to display in a single waveform chart?

Thanks, Ben

 

 

0 Kudos
Message 5 of 6
(3,942 Views)
Hey Ben,

The problem you're experiencing most commonly occurs as a result of using an incorrect range.  Keep in mind that when you're using a scale, that the max and min values are no longer the maximum and minimum voltage, but in fact the maximum and minimum scaled values.  Set these values as necessary and see if that doesn't fix the problems you're experiencing.

If not, let us know and we'll try something else.
Elijah Kerry
NI Director, Software Community
0 Kudos
Message 6 of 6
(3,926 Views)