Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to sample points

I have a program that does standard DAQ, I am failry new to all this but I do kind of understand how it works. My program does the data Aqcuisition, does some processing and displays the data (V vs. T, f, d vs. T) ect. I need to be able to write this data to a text file  as well as diplaying it in a graph. What I am not sure about is when to write the data to disk. Let's say I am sampling at 40KHz and I am taking 32768 points if I wanted to record the data for each point I sample how would I do this?

I am using the

DAQmxReadAnalogF64 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, float64 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

function to get the data. Am I right in thinking that for each call to DAQmxReadAnalogF64 that I get one sample for that channel  with 32768 points?

ANy help or explanations would be great, thanks in advance

J
0 Kudos
Message 1 of 3
(2,542 Views)
Hello Salsipius,
 
The NI-DAQmx C Reference Help File is the best place to get specific information on these functions.  It installs at Start >> Programs >> National Instruments >> NI-DAQ.  Examples for using the functions are found at C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage.  I think you would be particularly interested in "Acq-Int Clk".
 
However, I suspect you may have already found this.  The DAQmxReadAnalogF64 will return however many samples you specify in numSampsPerChan for each channel that exists in your task specified by taskHandle.  If you have a task with 4 channels and set numSampsPerChan = 32768, then the data you get back will be 4 channels with 32768 samples each.  Using a rate of 40KHz, you will acquire this data in just under a second.  After it is acquired you could write the array to file. 
 
Hope this helps,
Laura
 
0 Kudos
Message 2 of 3
(2,528 Views)
Thank you Laura,

I did finaly figure it out, unfortunatley writing it to a file takes to long for what I need, I am going to have to look at multithreading or some other way of saving this data, but thank you for your input.

J
0 Kudos
Message 3 of 3
(2,526 Views)