06-08-2023 12:58 PM
Hello,
I am trying to write a sin wave to a task continuously until it reaches the duty cycle limit with USB-6353. The program executes fine, but I keep getting DaqWarning 200015 during each cycle:
"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."
I've tried lowering the sample rate and increasing the buffer size but have had no luck so far. I'm not sure how to resolve this warning.
I am using NI-DAQmx Python package to interact with the hardware.
Any input would be appreciated to help resolve this warning.
Thanks.
import nidaqmx
from math import sin,pi
from nidaqmx._task_modules.timing import Timing
from nidaqmx import Task
from nidaqmx.constants import AcquisitionType
from nidaqmx.stream_writers import AnalogSingleChannelWriter
Freq = 5000
Amp = 1
Samples= 200
DutyCycle = 100
TotalSamp = Samples*DutyCycle
Rate = Freq*Samples
Data= []
for i in range(Samples):
Data.append(Amp * sin(i*2.0*pi/Samples))
MainTask = Task()
Timing.cfg_samp_clk_timing(Rate, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=TotalSamp)
Count = 0
OutObj = MainTask.out_stream
SignalStreamer = AnalogSingleChannelWriter(OutObj, auto_start=True)
while Count <= DutyCycle:
SignalStreamer.write_many_sample(Data, timeout=10.0)
Count += 1
06-29-2023 07:08 AM
A typical rule of thumb for DAQmx buffered acquisition is to read or write about 1/10 sec worth of samples per call. This tends to work out well for quite a lot of applications.
With your sample rate of 1 MHz, try writing 100000 samples at a time rather than 200.
-Kevin P