Acquire Data and Generate Signals at the Same Time for usb 6008
2 次查看(过去 30 天)
显示 更早的评论
i used this code to aquire and write signals in usb 6008 simultaneously but message error appeared . how to solve that?
% The hardware associated with this session is reserved. If you are using it in another
session use the release function to unreserve the hardware. If you are using it in an
external program exit that program. Then try this operation again.
% % Initialization
%%get connected devices d = daq.getDevices %create session s = daq.createSession('ni')
%add analog channel s.addAnalogInputChannel('ID',channel num, 'measurement type')
s.addAnalogInputChannel('Dev1','ai0', 'Voltage')%irradiance
s.addAnalogInputChannel('Dev1','ai1', 'Voltage')%Temperature
s.addAnalogOutputChannel('Dev1', 'ao0', 'Voltage')
% set rate of scan 1000 scans/second , run for 30 seconds
s.Rate=100;
duration = s.DurationInSeconds
v.TerminalConfig = ' Differential';
%v.TerminalConfig = ' SingleEnded';
%_____________________________
%aquire data and process
lh = s.addlistener('DataAvailable', @plotData)
%store data
h = s.addlistener('DataAvailable', @storedata);
% Analog Output
ao_value = 3.5;
s.outputSingleScan(ao_value)
s.startBackground() s.wait()
delete (lh)
delete (h)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Periodic Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!