DAQ output randomly stops during continuous acquisition

7 次查看(过去 30 天)
I am using the following code to output a constant voltage on channel 2 of a NI-PCI-6229 DAQmx device. I am using Matlab R2014a.
The problem is that after some period of time (sometimes 5-20 minutes), the device stops outputting the data continuously. After stopping, the device property: IsDone changes from 'flase' to 'true'. No error messages are generated upon completion.
devices = daq.getDevices;
s = daq.createSession('ni');
s.Rate = 10000;
s.IsContinuous = true;
addAnalogOutputChannel(s,'Dev1',2,'Voltage');
outputSignal = ones(s.Rate,1);
queueOutputData(s, outputSignal);
lh = addlistener(s, 'DataRequired', @(src,event) src.queueOutputData(outputSignal));
startBackground(s);

回答(3 个)

Rebecca Krosnick
Rebecca Krosnick 2016-1-22
I tried running your code in MATLAB R2014a (after creating the simulated device in NI MAX) and got the following output in MATLAB:
Warning: This change caused queued output data to be flushed. Use queueOutputData to queue data before starting the object.
Queue at least 5000 scans to output buffer. See NotifyWhenScansQueuedBelow for more information.
Did you not receive these errors? Try changing "outputSignal" to be a vector of 5000, as the error message suggests. For example:
outputSignal = ones(5000, 1);
  1 个评论
David P
David P 2016-1-25
Yes, I replaced this piece of code with 1 to make it simpler to understand my problem, but I didn't realize it was wrong. The output vector should be a vector of ones. I have changed this in my original question now. Thanks for your response and sorry for the confusion.

请先登录,再进行评论。


Timothée
Timothée 2018-5-23
Hi,
Did you solve this problem? I have the same issue. It stops after around 3.5 hours at 1MHz and this time seems reproducible.
  3 个评论
Alex King
Alex King 2018-12-3
I'm also having this issue, with both the NI USB-4431 & USB-6356. I'm trying the suggestion from the other answer now, queuing more than 5000 samples of output data, even though I do not get this warning.
The time it stops seems to be reproducible here too (although different for the two cards). I will try to find time investigations with different sample rates. Perhaps it has to do with the buffer size of the card?
Windows 7 & 10, MATLAB R2018b

请先登录,再进行评论。


Hooman Sedghamiz
Hooman Sedghamiz 2019-8-24
I have seen many questions in regards to DAQ session issues, some even dating back to 2016 but no answer so far. I am having the same issue and the output generation stops everytime at sample number 8196, even when I change the signal which is being outputed...
Is this a bug? Please be kind and resolve this!

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by