Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

DAQmxReadAnalogF64 start delay

I'm controlling a USB-6009 in VB6.   The first task which is issued is a counter. The value of the counter is continually read using DAQmxReadCounterScalarF64, until a specific value is reached.  At this point an DAQmxCreateAIVoltageChan task is initiated, and DAQmxReadAnalogF64  is issued to sample a finite number of samples.  My problem is this, there seems to be a delay of approximately 25 milliseconds before analogue sampling actually commences.
I've tried the following changes to the program,
1.  Create the analogue sampling task at the start of the program, but this doesn't save much time.
2.  Issued DAQmxStartTask at the start of the program, but when i do this, i get no data when i issue DAQmxReadAnalogF64.
3.  Issued DAQmxTaskControl(taskHandleAnalog, DAQmx_Val_Task_Commit) at the start of the program.  This cuts the delay to 12 milliseconds.
Has anyone had a similar experience, and found a way of removing the delay when issuing DAQmxReadAnalogF64  ?
Kind regards
0 Kudos
Message 1 of 3
The counters on the USB 6009 are pretty limited, so this might not work...

Set up the analog input task with a trigger. Use the /dev1/ctr0internaloutput as the trigger source. Start the task immediately; nothing will happen until the trigger is asserted.

Configure the counter to count down from a pre-set count. When it gets to zero, the output should toggle, triggering the analog input.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
0 Kudos
Message 2 of 3
Many thanks for the response.  I solved my problem by issuing DAQmxStartTask at a suitable point during the counter reading.  When I initially posted my message I was not fully aware of the processes run by DAQmxStartTask. I thought it simply primed the task for reading, and the actual sampling was conducted when DAQmxReadAnalogF64 was issued.  I now understand that the sampling is actually performed when DAQmxStartTask is issued, and DAQmxReadAnalogF64 simply extracts the data. 
Thanks again
0 Kudos
Message 3 of 3