10-06-2010 12:40 PM
Hello
I am trying to a multi-function sync AI-AO with USB 4431. The program is running fine, but when I stop the program it gives me a warning
"While writing to the buffer during a regeneration, the actual data generated might have alternated between old data and new data. That is, while the driver was replacing the old pattern in the buffer with the new pattern, the device might have generated a portion of new data, then a portion of old data, and then a portion of new data again.
Reduce the sample rate, use a larger buffer, or refer to documentation about DAQmx Write for information about other ways to avoid this warning."
My Sample rate for AI is 10000 and AO is 5000
I am not sure what to change and where?
Can somebody enlighten me what I should do for this warning not to occur
Regards,
Nitin
Solved! Go to Solution.
10-07-2010 02:33 PM
Hi Nitin,
This is only a warning, so it will not cause you any issues, but it is merely a recommendation. However, because your input is twice as fast as your output, are you taking twice as many samples off of the buffer each iteration? Also, are you using the input signals for a control system output? How are you synchronizing the two tasks? Perhaps a screenshot of the block diagram could shed more light ton the situation.
Best,
10-07-2010 02:59 PM
Hi Adam
The warning is occuring at DAQmx AOwrite. I am trying to output a sound wave from the speaker from AO and then measure it thru AI. I am also trying to change the wave signal on the fly. But when doing so I am getting a delay of 5 sec after I change the signal. I am not sure what is the correct sample size in order for not getting this much of a delay. It is not a big problem as of now, but I would like to reduce the delay. I am attaching the block diagram of my program. Please take a look and let me know. I have changed the Error outpot to just display the error if any and not show any warnings which solves my original problem.
Best Regards,
Nitin
10-07-2010 04:57 PM
Hi Nitin,
Try using non-regeneration to ensure that the data being output is not a mix of old and new data.
The latency is going to be proportional to the number of samples that have already been written that still need to be clocked out. The 4431 has a 4095 sample FIFO that can not be reduced. In addition, there is a DAQmx Buffer in RAM that is user-configurable, it defaults to the number of samples in your first call to DAQmx Write. The maximum latency therefore is going to be:
(4095 + DAQmx_Buffer_Size) / Sample_Rate
To minimize latency, you'll need to 1) output at a relatively fast rate to minimize the effect of the onboard FIFO and 2) limit the amount of data that you write per loop iteration (although make it high enough so that you don't underflow).
Best Regards,