Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Warning 200015 occurred during continuous write to Task

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

 

0 Kudos
Message 1 of 2
(666 Views)

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

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 2
(545 Views)