Measurement Computing   Easy to Use | Easy to Integrate | Easy to Support catalog banner

Simple Analog Output Script Using MATLAB R2017a and an...

Expand / Collapse
 

Simple Analog Output Script Using MATLAB R2017a and an USB-1408FS-Plus


After successfully configuring a Windows system to use an USB-1408FS-Plus module with MATLAB R2017a (reference KB article - http://kb.mccdaq.com/KnowledgebaseArticle50721.aspx), the following lines were used in a .m script to output single voltage values via the analog output channel.

% Create analog output session
s = daq.createSession('mcc');
    
% Add an analog output channel from device ID (Board0) and channel ID (Ao0),
% with the measurement type to 'Voltage'.
ch0 = addAnalogOutputChannel(s,'Board0', 'Ao0', 'Voltage');
    
% Set voltage level for analog output channel to step from 0 to 5 volts
for i=0:5
    aout = i;
    outputSingleScan(s, aout);
    pause(1);
end

% Reset voltage output level
aout = 0;
outputSingleScan(s, aout);

%% Cleanup
delete (s);



Rate this Article:
Tags:

Add Your Comments


For comments email TechSupport@mccdaq.com.

Details
Article ID: 50725

Last Modified:9/21/2017 4:40:28 PM

Article has been viewed 1,728 times.

Options