08-04-2008 02:26 PM - edited 08-04-2008 02:29 PM
08-05-2008 04:12 AM
Hi,
After replicating the problem, you are getting the error at the daq assistant 2 because you are only reading 1 number into the data input. This is because you have specified waveform timing as the source of number of samples and sampling rate. You need to specify some sampling and timing information for this input, as the least number of samples it can read in is 2.This can be done by either double-clicking the daq assistant 2 VI and unchecking "Use waveform timing" next to generation mode, or specifying 1 sample on demand.
As another point, on the daq assistant on the left hand side of your application, you have specified samples of 10K per second, but you are only actually reading 40 of them at a time. This number should be increased in order to keep up.
If you check out this KB if should give you more information on that specific error code.
Regards,
Mike
08-05-2008 08:41 AM - edited 08-05-2008 08:44 AM
08-05-2008 10:14 AM
08-05-2008 10:46 AM - edited 08-05-2008 10:46 AM
08-05-2008 05:22 PM
Hello PMN,
There are two numbers to consider here: Sample Rate and Samples to Read
Sample Rate: This number sets up the timing for your acquisition. If you choose 400 Hz the hardware will collect samples at 400 Hz for each of the specified analog input channels and put them into a buffer at the same rate.
Samples to Read: This is the number of samples you will remove from the above buffer each time you read samples.
In order to have a sustained acquisition you have to empty the buffer as fast as you fill it, otherwise your buffer will overflow. For example, if you acquire at a Sample Rate of 400 Hz and Samples to Read is 40 then you need to read at least 10 times a second to avoid an eventual buffer overflow.
That’s a brief overview of what these values mean. For your specific question, you display ten times the amount of data because each loop iteration the DAQ Assistant returns 400 points rather than 40 points and the loop runs 10 times slower. Essentially you're not changing the buffer size, your explicitly changing the number of samples to read in each iteration.
I hope this helps, and have a great day!
08-06-2008 08:24 AM
08-06-2008 09:12 AM - edited 08-06-2008 09:12 AM
08-07-2008 02:18 PM
Hello pmn,
The loop iteration speed is however long it takes for all of the VIs in the loop to run. If you have a DAQmx Read in a loop, that VI is "blocking" until the specified number of samples are available in the buffer. If you specify 100 samples that VI will wait until they are available and then allow execution to continue. If you specify -1 samples the DAQmx Read VI will pull all of the available samples and continue execution immediately.
If you have additional analysis in series with the DAQmx Read the total loop iteration time will be the time to read + the analysis time. If you have a Wait (ms) VI in your loop it is a parallel process and the loop iteration will be the larger of the wait time and the code execution time.
With a simple acquisition, a majority of the loop time will be determined by the sample rate and the samples to read. I.e. if you sample at 1 kHz and read 100 samples each iteration, your average loop time has to be 0.1 seconds to avoid overflowing the buffer.
Cheers,