Info

This question is closed. Reopen it to edit or answer.

Timeout during GETDATA with NI 6008 USB DAQ - after repeated use in a function

1 view (last 30 days)
The Matlab program controls a test rig. DAQ is an inexpensive USB based National Instruments 6008.
The function listed below is part of a larger overall program. It is used to gather bursts of data - typically about 1 second duration. This works well - for a time. But after repeated calls [7 minutes or so], we get the error and the program & rig shut down.
The error is "A timeout occurred during GETDATA".
Any helpful solution would be greatly appreciated.
================
% Function to log real time load and temperature
% data using a National Instruments USB 6008 DAQ
function logloadtemp(hObject, handles, TimeSampleSec)
LogFreqHz = 100;
DataPoints = LogFreqHz * TimeSampleSec ;
AI = analoginput('nidaq', 'Dev1');
set(AI,'InputType','SingleEnded');
set(AI,'SampleRate',LogFreqHz);
set(AI,'SamplesPerTrigger',(DataPoints+1));
addchannel(AI,1);
addchannel(AI,2);
addchannel(AI,5);
addchannel(AI,6);
start(AI);
data = getdata(AI,DataPoints);
stop(AI);
delete(AI);
clear AI;
averagedata = mean(data);
handles.datadragloadlbsraw = 41.5 * averagedata(3) - 1.6;
handles.datalinkloadlbs = 1688.6 * averagedata(1) - 316.7;
handles.datauprighttemp = 2540 * averagedata(2) - 268.1;
handles.datablockbearingtemp = 2540 * averagedata(4) - 282.1;
guidata(hObject,handles);

Answers (0)

Community Treasure Hunt

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

Start Hunting!