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 ?
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.