Error: Analog Output underflow event
14 次查看(过去 30 天)
显示 更早的评论
I am trying to simultaneously record two analog inputs and create a digital output using a National Instruments DAQ. I cannot get around this error, however, and I have not found any posts that specifically address it. The most confusing part is that I am not actually using any analog outputs! The last valid output is always a little less than half of what it should be. For example, if the output signal is 1e6x1, then the last valid output scan number is 498552. Here is the code:
s = daq.createSession('ni');
Dch = addDigitalChannel(s,'Dev1','Port0/Line0','OutputOnly');
Ach = addAnalogInputChannel(s,'Dev1',0:1,'Voltage');
Ach(2).TerminalConfig = 'SingleEnded';
Ach(2).Range = [-5 5];
s.Rate = 250000/length(Ach);
ActualRate = get(s,'Rate');
L = 2; % number of seconds of each voltage pulse
TotalTime = 8; % total output signal length in seconds
n = TotalTime/L/2; % number of times to repeat a pair of pulses
tempOutputSignal = [5*ones(1,L*ActualRate) zeros(1,L*ActualRate)];
OutputSignal = repmat(tempOutputSignal,1,n)';
OTime = linspace(0,TotalTime,length(OutputSignal));
figure, plot(OTime,OutputSignal);
s.queueOutputData(OutputSignal);
duration = s.DurationInSeconds;
[data,time] = s.startForeground;
Update: I have worked on this issue through the National Instruments forum and can say with some certainty now that it is not a hardware issue, but is, in fact, an issue with the code. Please help!
3 个评论
cecile conrad
2022-5-2
@Sarah Miller / @Daniel did you figure out what the problem was? I have the same error and am not able to figure it out with the example listed below.
Eric Ng
2024-8-20
I somehow managed to avoid this by reducing the sampling rate. I suspect it has to do with PC/MATLAB not fast enough to grab data from NI due to whatever reason or NI has a miss. I did not have this issue when I used the USB 6366 version of NI till I migrated it to a CDAQ 9189 version. My CDAQ version should be more powerful in every aspect vs the USB version except for the very limited FIFO size vs the USB version.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Analog Input and Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!