| Contents | Index |
myScope = oscilloscope()
connect(myScope);
set(myScope, 'P1',V1,'P2',V2,...)
waveformArray = getWaveform(myScope);
The Quick-Control Oscilloscope can be used for any oscilloscope that uses VISA and an underlying IVI-C or IVI-COM 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 = getWaveform(myScope); acquires a waveform from the scope.
For information on the prerequisites for using oscilloscope, see Quick-Control Oscilloscope Prerequisites.
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 channel(s). disableChannel('Channel1');
disableChannel({'Channel1', 'Channel2'}); |
| enableChannel | Enables oscilloscope's channel(s) from which waveform(s) will
be retrieved. enableChannel('Channel1');
enableChannel({'Channel1', 'Channel2'}); |
| getDrivers | Retrieves a list of available oscilloscope instrument drivers.
Returns a list of available drivers with their supported instrument
models.drivers = getDrivers(myScope); |
| getResources | Retrieves a list of available resources of instruments. It
returns a list of available VISA resource strings when using an IVI-C
or IVI-COM scope. It returns the interface resource information when
using a Tektronix scope.res = getResources(myScope); |
| getVerticalCoupling | Returns the value of how the oscilloscope couples the input
signal for the selected channel name as a MATLAB string. Possible
values returned are 'AC' and 'DC'.VC = getVerticalCoupling(myScope, 'Channel1'); |
| getVerticalOffset | Returns location of the center of the range for the selected
channel name as a MATLAB string. 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 string. The units
are volts.VR = getVerticalRange(myScope, 'Channel1'); |
| getWaveform | Returns the waveform(s) displayed on the scope screen. Retrieves
the waveform(s) from enabled channel(s).w = getWaveform(myScope); |
| setVerticalCoupling | Specifies how the oscilloscope couples the input signal for
the selected channel name as a MATLAB string. Valid values are 'AC'
and 'DC'.setVerticalCoupling(myScope, 'Channel1', 'AC'); |
| setVerticalOffset | Specifies location of the center of the range for the selected
channel name as a MATLAB string. 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 string. The
units are volts.setVerticalRange(myScope, 'Channel1', 10); |
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 open or closed. |
| Timeout | Use to get or set a timeout value. Value cannot be negative number. Default is 10 seconds. |
| AcquistionTime | 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. |
| AcquistionStartDelay | 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. |
| 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 auto or manual. Default is auto. auto means you do not have to set a driver name before connecting to an instrument.If set to manual, a driver name must be provided before connecting. |
| Driver | Use only if set DriverDetectionMode to manual. Then use to give driver name. Only use if driver name cannot be figured out programmatically. |
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 = getResources(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 acquistion time to 0.01 second.
set(myScope, 'AcquistionTime', 0.01);
% Set the acquistion 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 = getWaveform(myScope);
% Plot the waveform and assign labels for the plot.
plot(waveformArray);
xlabel('Samples');
ylabel('Voltage');

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |