Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Two AI task: works only the first

I'm using the following hw/sw:
USB-6008, NI-DAQmx 7.5, VC++ 6.0

I created two AI tasks: the first to measure an indoor temp (with a LM35
followed from an amplifier based on a 1/2 LM358 that scale to 0..2.5V),
the second to measure an outdoor temp. (AD590 a 1k resistor and an
amplifier with LM358 to scale to 0..2.5V);
then I created two AIVoltageChan (with DAQmxCreateAIVoltageChan) each
associated with a task previously created.

Finally, I read (with DAQmxReadAnalogScalarF64) the voltage of each task
to print through a printf.

The issue is that the first task runs with no problem, temperature is
displayed right, but the second one got an error, print
-925596313493178310000000000...0000 !!!)

I checked source seems to be all ok.

Where I'm mistaking?? Thanks in advance


0 Kudos
Message 1 of 4
(4,198 Views)
Hi rossi,

In any DAQmx application, you can only run one analog input task at a time on one device.  You can create one analog input task and add both of your temperature channels to this same task.  This may be the cause of the error you are getting, but I cannot be sure since the message that you posted is not a normal one.  You should make sure that you are using proper error handling with the DAQmxErrChk function.  If you are not sure how to do this, please refer to any of the DAQmx C examples that install by default to C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C.

I hope this helps!

Best regards,
0 Kudos
Message 2 of 4
(4,188 Views)
Jarrod B. ha scritto:
> Hi rossi,In any DAQmx application, you can only run one analog input task at a time on one device.

Here is that DAQmxErrChk prints out (only Indoor_Temp, the first task
runs properly); any hint how about I can get the value from each voltage
channel of the same task? I can't use DAQmxReadAnalogScalarF64?

Status Code: -50103
DAQmx Error: The specified resource is reserved. The operation could not
be completed as specified.
Task Name: Relative_Humidity

Status Code: -50103
[Temp.int.: 20 C] [Temp.est.:
-925596313493178310000000000000000000000000000000
DAQmx Error: The specified resource is reserved. The operation could not
be completed as specified.
Task Name: Outdoor_Temp
0 Kudos
Message 3 of 4
(4,185 Views)
Hi rossi,

When you have an analog input task with more than one channel, you can read the values from each channel using the function DAQmxReadAnalogF64.  For more information about this function, please refer to the NI-DAQmx C Reference Help located in Start >> Programs >> National Instruments >> NI-DAQ.

Best regards,
0 Kudos
Message 4 of 4
(4,182 Views)