NIDAQmxError200019: 'ADC Overrun Error'

17 次查看(过去 30 天)
I am using the DAQ control toolbox in conjunction with a NI 9239 ADC and a NI 9482 relay. Matlab version is R2016a.
The relay (which is connected to an output channel) switches one piece of equipment on, and the ADC (which is connected to an input channel) listens for a response.
I can get the functionality I want out of the relay and the ADC, but not when they're in the same session.
When both channels are part of the same session, I get this:
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
I am not using an external clock, nor is an external clock supported by the NI 9239.
What I've tried:
--I have reduced the sampling rate from 50 kS to 1.7 kS. (both of these are within the range for the NI 9239)
--Setting the maximum number of threads to one using maxNumCompThreads.
--introducing several seconds of pause in between the instances of the 'startForeground' command.
-- using a listener to perform the analysis on the data recorded by the ADC
Nothing here has done anything resolve my issue.
%How many times per minute the switch will be flipped
switchesPerMinute= 30;
name9482 = 'cDAQ2Mod4';
name9239 = 'cDAQ2Mod3';
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%get rid of old DAQ sessions
daq.reset();
%connect to DAQ
sesh = daq.createSession('ni')
%Set the time for switch to be turned on
switchTime= 0.05;
%Setup input channel
inputCh = addAnalogInputChannel(sesh, name9239, 'ai0', 'Voltage');
inputCh.TerminalConfig = 'Differential';
sesh.Rate = 1700;
%calculate threshhold
[data,~,~] = startForeground(sesh);
threshold = mean(data) + .25;
%setup output channel
outputCh = addCounterOutputChannel (sesh, name9482, 3, 'PulseGeneration');
outputCh.Frequency = 2;
outputCh.DutyCycle = outputCh.Frequency *switchTime;
% set up pause between runs
sesh.DurationInSeconds = 1/outputCh.Frequency;
pauseTime = 60/switchesPerMinute- sesh.DurationInSeconds;
% determine number of iterations of loop to be used in three minutes
loopCount = 180/(pauseTime+sesh.DurationInSeconds);
alarmCount = 0;
maxNumCompThreads(1)
for i = 1:loopCount;
try
disp('startForeground');
Data = startForeground(sesh);
if nnz(Data>0)>300
alarmCount = alarmCount+1;
end
disp('stopForeground');
catch ME
disp(ME.message);
end
pause(pauseTime);
end
What my output looks like:
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
stopForeground
startForeground
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
startForeground
stopForeground
startForeground
stopForeground
startForeground
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
startForeground
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
startForeground
stopForeground
startForeground
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
startForeground
ADC Overrun Error: If you are using an external clock, make sure that the clock frequency matches session rate.
startForeground
stopForeground
startForeground

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by