Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to read data from 6 ai channels and 1 counter channel at the same time on NI 6123

I created two tasks: one for a counter (ctrHandler).  one for 6 ai channels (datHandler).

 

Use DAQmxReadCounterScalarU32 and  DAQmxReadAnalogF64 can not give the data generated at the same time. There is software time delay.

DAQmxReadCounterScalarU32(ctrHandler,10.0,&ctrValue,NULL);

DAQmxReadAnalogF64(datHandler,-1,10.0,DAQmx_Val_GroupByChannel,data,400*numLaser,&read,NULL);

 

How to make synchronization on card?

 

 

0 Kudos
Message 1 of 5
(6,935 Views)

Are you trying to synchronize the analog reads witht the counter measurements?  If so to do this use an Arm trigger for the counter, and a Start trigger for the analog inputs.  If you use the same source for the both the arm and start trigger they will both start at the exact same time. For more information on triggers please refer to the DAQmx C Reference help.  There is a topic entitled: 'List of Trigger Properties'which should answer most the questions that you have.

 

 

 

 

Charley Dahan

Global Account Manager
0 Kudos
Message 2 of 5
(6,907 Views)

CharlesD,

 

I read the information on triggers. the Start trigger and arm start trigger seem to synchronize starting tasks.

but I want to synchronize DAQmxReadCounterScalarU32 and  DAQmxReadAnalogF64 two functions.

So after the tasks started. I can get the input data and counter data at every certain time.

 

ex. at every time T, I need the analog data at timeT and counter data at timeT. but if I use

DAQmxReadAnalogF64(datHandler,-1,10.0,DAQmx_Val_GroupByChannel,data,400*numLaser,&read,NULL);

DAQmxReadCounterScalarU32(ctrHandler,10.0,&ctrValue,NULL);

to read data. Actually I will only get analog data at timeT and counter data at timeT+t. (t is the delay time between the two functions)

 

how can I get both data at the same time but not stop tasks.

0 Kudos
Message 3 of 5
(6,898 Views)
never mind. I will read all the data in the buffer.
0 Kudos
Message 4 of 5
(6,894 Views)

hi lwu,

 

I know it's old post, but...

 

Could you tell me (or paste code) how to read all data in the buffer?

 

I'm struggling with the same problem (4 ai channels and 1 counter channel)

0 Kudos
Message 5 of 5
(5,433 Views)