Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

2 channel simple acquisition in daqmx

Hi! i'm trying to program my PCI-6220 with Ni DAQmx visual C to acquire simple data from 2 different channels.

I saw the example on acquiring one simple data from one channel. so i tried to add another channel by adding another task and changing the channel number and using the read function.

The program runs but gives me the following message: "DAQmx Error: the specified resource is reserved. the operation could not be completed as specified."

The thing is that i have already done this procedure of two channel simple acquisitions with Ni DAQ  using a PCI-6024E and it worked by simply defining another channel, another read function and another error handler. in DAQmx that doesn't work. If anyone could please help me.


0 Kudos
Message 1 of 5
(2,848 Views)
You cannot have multiple tasks that access the same hardware. That means that you can only have a single task for analog in or analog out. You have to change your channel list. For example, you can specify Dev1\ai0:3 to acquire channels 0 through 3. Dev1\ai0,Dev1\ai3 will acquire channels 0 and 3 but not 1 and 2.
0 Kudos
Message 2 of 5
(2,838 Views)
Thank you for your reply.
I made as you told me and it works by changing the function DAQReadAnalogScalarF64 to DAQReadAnalogF64.
but i am obliged to have multiple tasks because i am programming a CCD and each time the CCD takes a set of pictures, i have to call DAQReadAnalogF64 to acquire data from two channels. so i am obliged to repeat the function as long as the CCD works.
I used to do it in NI-DAQ and i'm a little surprised to know that i cannot do it with NI-DAQmx.
0 Kudos
Message 3 of 5
(2,834 Views)

I still don't see why you need multiple tasks. The function will return the data for both channels.

You could write your code to emulate the traditional daq. You would need to start and stop each task though and that is going to be time consuming.

0 Kudos
Message 4 of 5
(2,825 Views)
Thank you! it just simply worked by stopping each task.
It is indeed time consuming, but it is not a big problem right now for my application.
0 Kudos
Message 5 of 5
(2,792 Views)