07-30-2007 06:52 AM
DAQmxCfgSampClkTiming(taskHandle,"",1000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,5000);
08-03-2007 08:56 AM
Hi,
You can found in your computer a documentation for all C function, you can found it on this directory : C:\Program Files\National Instruments\NI-DAQ\docs\cdaqmx.chm
On DAQmxReadAnalogF64, you need put the array size for your data :
int32 DAQmxReadAnalogF64 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, float64 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);
| arraySizeInSamps | uInt32 | The size of the array, in samples, into which samples are read. |
On your program, you have choose to put a array with 5000 samples (no more), have you try to increase this parameter ?
Regards,
Christophe S.
Account Manager East of France І Certified LabVIEW Associate Developer І National Instruments France
08-06-2007 03:04 AM
08-06-2007 03:44 AM
I have made my program to output the time when the DAQmxReadAnalogF64 function, ie the Read function, is called and how many samples are read on each call, here are the results:
Start of the acquisition
Calling Read function, time elapsed since acquistion started: 109ms
Read function called, number of sample read on this call: 0
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 96
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 1024
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 1024
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 1024
Calling Read function, time elapsed since last call: 1000ms
Read function called, number of sample read on this call: 992
End of the acquisition
So as you can see, the maximum number of samples read is 1024, while my buffer size and data array size is 5000. What I would expect is the number of samples read adding up after each call until it reaches the buffer size of 5000 and then remain at 5000 but it is not working like that, instead it is working as if the buffer was totally cleared after a DAQmxReadAnalogF64 function call. The documentation is quite blurry on that point and the more I read the definition of the DAQmxStartTask function the more I think this is weird and that the buffer should only be "updated" (shifiting the data inside it) on a DAQmxReadAnalogF64 call and cleared only when one calls the DAQmxStopTask.
Antoine
08-06-2007 05:08 AM
08-06-2007 06:44 AM
Thanks for your time Kamal but your code is not answering my questions as I don't want to recover exactly 1000 samples per iterations.
My question is as this is a circular buffer as you mentioned how come it is only filling up to 1000 samples while it can contain 5000. I mean, as it is a circular buffer, my expectation would be to this the buffer works like described below:
buffer = [0*5000] (buffer of size 5000 filled with zeros)
start acquisition
1st iteration (after 1sec): buffer = [0*4000 | 1000 samples from the 1st iteration ]
2nd iteration (after 1sec): buffer = [0*3000 | 1000 samples from the 1st iteration | 1000 samples from the 2nd iteration]
3rd iteration (after 1sec): buffer = [0*2000 | 1000 samples from the 1st iteration | 1000 samples from the 2nd iteration | 1000 samples from the 3rd iteration]
4th iteration (after 1sec): buffer = [0*1000 | 1000 samples from the 1st iteration | 1000 samples from the 2nd iteration | 1000 samples from the 3rd iteration | 1000 samples from the 4th iteration]
5th iteration (after 1sec): buffer = [1000 samples from the 1st iteration | 1000 samples from the 2nd iteration | 1000 samples from the 3rd iteration | 1000 samples from the 4th iteration | 1000 samples from the 5th iteration]
6th iteration (after 1sec): buffer = [1000 samples from the 2nd iteration | 1000 samples from the 3rd iteration | 1000 samples from the 4th iteration | 1000 samples from the 5th iteration | 1000 samples from the 6th iteration]
7th iteration (after 1sec): buffer = [1000 samples from the 3rd iteration | 1000 samples from the 4th iteration | 1000 samples from the 5th iteration | 1000 samples from the 6th iteration | 1000 samples from the 7th iteration]
etc...
However it seems to actually work like this:
buffer = [0*5000] (buffer of size 5000 filled with zeros)
start acquisition
1st iteration (after 1sec): buffer = [0*4000 | 1000 samples from the 1st iteration ]
2nd iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 2nd iteration]
3rd iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 3rd iteration]
4th iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 4th iteration]
5th iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 5th iteration]
6th iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 6th iteration]
7th iteration (after 1sec): buffer = [4000*0 | 1000 samples from the 7th iteration]
etc...
And I don't understand why considering I am entering -1 as parameter for the number of samples to retrieve from the acquisition buffer. I hope it makes more sense to you put this way.
Antoine
08-06-2007 07:00 AM
08-06-2007 07:27 AM
Thanlk you. I have a few questions there:
In the DAQmxReadAnalogF64 function when it is written "buffer" it refers to the RAM buffer or to the CVI buffer?
And what do you mean by:
"Your array data allows us to recover data from this buffer.
You array data don't have the same behavior as your array."
Shall we continue in French?
Antoine
08-06-2007 08:08 AM
08-06-2007 08:57 AM