oscilloscope
Create Quick-Control Oscilloscope object
Syntax
myScope = oscilloscope()
connect(myScope);
set(myScope, 'P1',V1,'P2',V2,...)
waveformArray = readWaveform(myScope);
Description
The Quick-Control Oscilloscope can be used for any oscilloscope that uses VISA and an underlying IVI-C driver. However, you do not have to directly deal with the underlying driver. You can also use it for Tektronix® oscilloscopes. This is an easy to use oscilloscope object.
myScope = oscilloscope()
creates an instance of the scope
named myScope
.
connect(myScope);
connects to the scope.
set(myScope, 'P1',V1,'P2',V2,...)
assigns the specified
property values.
waveformArray = readWaveform(myScope);
acquires a waveform
from the scope.
For information on the prerequisites for using oscilloscope
,
see Quick-Control Oscilloscope Requirements.
The Quick-Control Oscilloscope oscilloscope
function can use
the following special functions, in addition to standard functions such as
connect
and disconnect
.
Function | Description |
---|---|
autoSetup | Automatically configures the instrument based on the input signal. autoSetup(myScope); |
disableChannel | Disables oscilloscope's channels. disableChannel('Channel1'); disableChannel({'Channel1','Channel2'}); |
enableChannel | Enables oscilloscope's channels from which waveforms will be retrieved. enableChannel('Channel1'); enableChannel({'Channel1','Channel2'}); |
drivers | Retrieves a list of available oscilloscope instrument drivers. Returns a list of available drivers with their supported instrument models. driverlist = drivers(myScope); |
resources | Retrieves a list of available resources of instruments. It returns a list of available VISA resource strings when using an IVI-C scope. It returns the interface resource information when using a Tektronix scope. res = resources(myScope); |
configureChannel | Returns or sets specified oscilloscope control on selected channel. Possible controls are:
value = configureChannel(myScope,'Channel1','VerticalOffset'); configureChannel(myScope,'Channel1','VerticalCoupling','AC'); |
getVerticalCoupling | Returns the value of how the oscilloscope couples the input
signal for the selected channel name as a MATLAB character
vector. Possible values returned are ' VC = getVerticalCoupling(myScope, 'Channel1'); |
getVerticalOffset | Returns location of the center of the range for the selected channel name as a MATLAB character vector. The units are volts. VO = getVerticalOffset(myScope, 'Channel1'); |
getVerticalRange | Returns absolute value of the input range the oscilloscope can acquire for selected channel name as a MATLAB character vector. The units are volts. VR = getVerticalRange(myScope, 'Channel1'); |
readWaveform | Returns the waveforms displayed on the scope screen. Retrieves the waveforms from enabled channels. w = readWaveform(myScope); |
setVerticalCoupling | Specifies how the oscilloscope couples the input signal for
the selected channel name as a MATLAB character vector. Valid
values are ' setVerticalCoupling(myScope, 'Channel1', 'AC'); |
setVerticalOffset | Specifies location of the center of the range for the selected channel name as a MATLAB character vector. For example, to acquire a sine wave that spans between 0.0 and 10.0 volts, set this attribute to 5.0 volts. setVerticalOffset(myScope, 'Channel1', 5); |
setVerticalRange | Specifies the absolute value of the input range the oscilloscope can acquire for the selected channel name as a MATLAB character vector. The units are volts. setVerticalRange(myScope, 'Channel1', 10); |
Arguments
The Quick-Control Oscilloscope oscilloscope
function can use
the following properties.
Property | Description |
---|---|
ChannelNames | Read-only property that provides available channel names in a cell array. |
ChannelsEnabled | Read-only property that provides currently enabled channel names in a cell array. |
Status | Read-only property that indicates the communication status.
Valid values are |
Timeout | Get or set a timeout value. Value cannot be a negative number. Default is 10 seconds. |
AcquisitionTime | Use to get or set acquisition time value. Used to control the time in seconds that corresponds to the record length. Value must be a positive, finite number. |
AcquisitionStartDelay | Use to set or get the length of time in seconds from the trigger event to first point in waveform record. If positive, the first point in the waveform occurs after the trigger. If negative, the first point in the waveform occurs before the trigger. |
TriggerMode | Use to set the triggering behavior. Values are:
|
TriggerSlope | Use to set or get trigger slope value. Valid values are
falling or rising . |
TriggerLevel | Specifies the voltage threshold in volts for the trigger control. |
TriggerSource | Specifies the source the oscilloscope monitors for a trigger. It can be channel name or other values. |
Resource | Set up before connecting to instrument. Set with value of your instrument’s resource string, for example: set(myScope, 'Resource', 'TCPIP0::a-m6104a-004598::inst0::INSTR'); |
DriverDetectionMode | Optionally used to set up criteria for connection. Valid
values are If set to |
Driver | Use only if set DriverDetectionMode to
manual . Then use to give driver name. Only
use if driver name cannot be figured out programmatically. |
Note
To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB® command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.
Examples
Create an instance of the scope called myScope
.
myScope = oscilloscope()
Discover available resources. A resource string is an identifier to the instrument. You need to set it before connecting to the instrument.
availableResources = resources(myScope)
If multiple resources are available, use your VISA utility to verify the correct resource and set it.
set(myScope, 'Resource', 'TCPIP0::a-m6104a-004598::inst0::INSTR');
Connect to the scope.
connect(myScope);
Automatically configure the scope based on the input signal.
autoSetup(myScope);
Configure the oscilloscope.
% Set the acquisition time to 0.01 second. set(myScope, 'AcquisitionTime', 0.01); % Set the acquisition to collect 2000 data points. set(myScope, 'WaveformLength', 2000); % Set the trigger mode to normal. set(myScope, 'TriggerMode', 'normal'); % Set the trigger level to 0.1 volt. set(myScope, 'TriggerLevel', 0.1); % Enable channel 1. enableChannel(myScope, 'Channel1'); % Set the vertical coupling to AC. setVerticalCoupling (myScope, 'Channel1', 'AC'); % Set the vertical range to 5.0. setVerticalRange (myScope, 'Channel1', 5.0);
Communicate with the instrument. For example, read a waveform.
% Acquire the waveform. waveformArray = readWaveform(myScope); % Plot the waveform and assign labels for the plot. plot(waveformArray); xlabel('Samples'); ylabel('Voltage');
Version History
Introduced in R2011b