Generate and Measure Signals with Analog Devices ADALM1000

Updated Function Syntax

To accommodate the ADALM1000, the following Data Acquisition Toolbox™ functions allow vendor-specific argument options:

Source Voltage and Measure Current

This example shows how to source a voltage while measuring current on the same channel, to calculate load resistance. First program the ADALM1000 to provide a constant 5 V supply to the load, and then measure the current on the same device channel.

Set up a Data Acquisition Toolbox session to operate the ADALM100.

s = daq.createSession('adi');

Define an analog output channel in the session to source voltage from device channel A.

addAnalogOutputChannel(s,'SMU1','A','Voltage');

Define an analog input channel in the session to measure current on that same device channel A.

addAnalogInputChannel(s,'SMU1','A','Current');

Generate an output voltage, and measure the current.

V_load = 5;
outputSingleScan(s,V_load);
I_load = inputSingleScan(s);
outputSingleScan(s,0);  % Reset device output.
R_load = V_load/I_load
R_load =

   50.3005

Note

The ADALM1000 continues to generate the last value programmed until you release the session. When you are finished with your signals, reset the device to output 0 volts.

Generate a Pulse

This example shows how to generate a 1-millisecond, 5-volt pulse, surrounded on either side by 10 milliseconds at 0 volts.

pdata = zeros(2100,1); % Column vector of 2100 samples.
pdata (1001:1100) = 5; % Pulse in middle of vector.

s = daq.createSession('adi');
addAnalogOutputChannel(s,'SMU1','B','Voltage');

queueOutputData(s,pdata);
s   % View channel configuration and scan settings.
s = 

Data acquisition session using Analog Devices Inc. hardware:
   Will run for 2100 scans (0.021 seconds) at 100000 scans/second.
   Number of channels: 1
      index Type Device Channel   MeasurementType        Range      Name
      ----- ---- ------ ------- ------------------- --------------- ----
      1     ao   SMU1   B       Voltage (SingleEnd) 0 to +5.0 Volts
startForeground(s);

Generate Waveforms

This example shows how to simultaneously generate a 1-kHz square wave on channel A, and a 100-Hz sine wave on channel B. Each output lasts for 5 seconds.

The example requires two session channels for device channels A and B, both as output channels for voltage.

s = daq.createSession('adi');
addAnalogOutputChannel(s,'SMU1','A','Voltage');
addAnalogOutputChannel(s,'SMU1','B','Voltage');

Define the two waveforms.

Sq = zeros(500000,1); % 500k sample column vectors
Sw = zeros(500000,1);

% Define square wave:
for r = 1:100:499900;
    Sq(r:r+49) = 5;  % Set first 50 of each 100 samples to 5 v.
end

% Define sine wave:
for a = 1:500000
    Sw(a) = sin(a*2*pi/1000);
end
Sw = Sw + 1;  % Shift for positive voltage output

queueOutputData(s,[Sq Sw])
s   % View channel configuration and scan settings.
s = 

Data acquisition session using Analog Devices Inc. hardware:
   Will run for 500000 scans (5 seconds) at 100000 scans/second.
   Number of channels: 2
      index Type Device Channel   MeasurementType        Range      Name
      ----- ---- ------ ------- ------------------- --------------- ----
      1     ao   SMU1   A       Voltage (SingleEnd) 0 to +5.0 Volts
      2     ao   SMU1   B       Voltage (SingleEnd) 0 to +5.0 Volts

Start generation that lasts for 5 seconds.

startForeground(s); 

See Also

Functions

Related Topics

External Websites