LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing rate slow down when adding read palette

Hi everyone. I'm now designing a project which can output data into 2 channels and mean time acquire data via another channel. Attached is my code. I can set the write rate up to 20000 before. But when I add the reading part the rate can't reach 20000 and an error states that it is underflow and I need to reduce the rate. But I think I'd better maintain 20000 to keep up with my expectation. I would be grateful if any help is offered. Thanks.

read&write.jpg

0 Kudos
Message 1 of 2
(2,017 Views)

Hi chen3477,

 

The first thing I notice is that you are using both a timing property node, and a timing VI to set up the sample clocks for the two tasks.  If the intention is for the analog input task to be slaved to the analog output task, then you can simply use the source input for the sample clock Timing VI to set the source to "ao/SampleClock" and accomplish that more easily.  I'm not sure that's your issue, but it wouldn't hurt.

 

Second, your output task is set to continuous, but you only ever write 400 samples.  That means that you are using regeneration, which should be the default.  In that mode, data is still transferred across the bus from your computer's memory to the DAQ device FIFO.

 

In general, DAQmx underflows are caused by data not being written to the bus fast enough to keep the device memory from emptying.  This can be impacted by a lot of things, but notably it depends on the speed of the bus.  Depending on the bus, the additional data being streams from the read operations might be enough to delay the written waveform being fully copied during regeneration.

 

To fix this, I would try setting the AO.UseOnlyOnBrdMem property on your task.  That should tell the DAQmx driver to only transfer the data once at the beginning of the task, and to reuse those samples on the device memory repeatedly.  Note that this is only valid if you do not need to change the waveform you are generating mid-task.  For more details, see this article on DAQmx regeneration: https://www.ni.com/en/support/documentation/supplemental/06/analog-output-regeneration-in-ni-daqmx.h...

 

Thanks,

 

 

 

Michael B.
Product Support Engineer
National Instruments
0 Kudos
Message 2 of 2
(1,933 Views)