LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx task timing

I'm not totally confused, but confused enough by the timing setup for DAQ tasks and the read calls made to actually acquire my data to make a post requesting clarification. What I need to achieve is a task that has multiple channels (14 in my case) with each one acquiring 100 samples per second, after receipt I average, log, and plot the value for each channel.

In my setup:
DAQmxCfgSampClkTiming (hTask, "", 200, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 100));
DAQmxRegisterEveryNSamplesEvent (hTask, DAQmx_Val_Acquired_Into_Buffer, 100,0, cbProcessDev1, NULL));

In my EveryNSamples callback (
cbProcessDev1😞
DAQmxReadAnalogF64 (hTask, 100, 10.0, DAQmx_Val_GroupByScanNumber, dataArray, 1400, &read, NULL));

The part that I'm not understanding is the value for rate in the DAQmxCfgSampClkTiming call, the reason I have this as 200 is because that's what gave me a 1 Hz sampling rate. But I don't know why it did. What values should I be using for these three functiuon calls to achieve the conditions mentioned above?

Thanks.
0 Kudos
Message 1 of 3
(2,964 Views)

coanda,

The 200 refers to the sampling rate in number of samples per second per channel.  The 100 after DAQmx_Val_ContSamps is configuring the buffer to be 100 samples.  If you would like to achieve a sampling rate of 100 samples per second per channel then please replace the 200 with 100.  If you have no trigger configured then 200 samples per second per channel should be written to DAQmx memory when the task is started. (with the posted code)  The read will take a predefined amount of data from DAQmx memory to your programming environment.  Also, where do you see a 1Hz sampling rate occuring and how are you viewing this?

0 Kudos
Message 2 of 3
(2,944 Views)
Ignore the bit about 200, I went and checked my program and it turns out that I copied the section from a different version, but didn't realize it so I was confused about that when I wrote the post. I do in fact have 100 for both and receive a 1 Hz sampling rate.

Thank you for your post, it helped me solve my problem, and sorry about my late reply. My project was put on hold for a week while I had to work on something more pressing.

Thanks again.
0 Kudos
Message 3 of 3
(2,878 Views)