Main Content

Reading Waveforms from an Oscilloscope Using a Quick-Control Oscilloscope Object

此示例显示如何使用快速控制示波器从示波器获取波形。

Instrument Control Toolbox™ software supports communication with instruments through Quick-Control Instrument objects. In this example you will learn to acquire a waveform from a Keysight Technologies® (formerly Agilent Technologies®) MSO6014 mixed signal oscilloscope using a Quick-Control oscilloscope object.

For a complete list of supported hardware, visit the Instrument Control Toolbox产品页面.

Introduction

This example is tested on a 32-bit Microsoft® Windows® system, National Instruments® Compliance Package 4.1 . Keysight I/O Suite and 546XX IVI-C driver version 1.3.20.0, which can be downloaded from Keysight’s website:http://www.keysight.com. Ensure that the VISA utility has been set up to recognize the instrument resource before you execute this example.

Creating an Oscilloscope

Before acquiring any data, you must create an oscilloscope instance.

myScope = oscilloscope()
myScope = oscilloscope: No connection has been setup with instrument, type help oscilloscope for more information

发现可用的资源

Find out available resources. A resource is a string identifier to the instrument. You have to set it before connecting to the instrument.

availableResources = GetResources(MyScope)
availableResources = TCPIP0::a-m6104a-004598.dhcp.mathworks.com::inst0::INSTR

Connecting to the Oscilloscope Object

If multiple resources are available, use a VISA utility to verify the correct resource and set it.

myScope.Resource ='TCPIP0::a-m6104a-004598::inst0::INSTR';%连接到仪器。连接(myScope);

Examine the Current Oscilloscope Setting

get(myScope);
AcquisitionTime: 0.0100 AcquisitionStartDelay: -0.0050 TriggerLevel: 0.1000 TriggerSlope: 'rising' TriggerSource: 'Channel1' WaveformLength: 2000 TriggerMode: 'normal' SingleSweepMode: 'on' ChannelNames: {'Channel1' 'Channel2' 'Channel3' 'Channel4'} ChannelsEnabled: {'Channel1'} Resource: 'TCPIP0::a-m6104a-004598::inst0::INSTR' Driver: 'Ag546XX' DriverDetectionMode: 'auto' Timeout: 10 Status: 'open'

配置示波器

Configure the oscilloscope's settings. The configuration we will use in this example is: acquisition time of 0.01 second with 2000 data points, trigger level of 0.1v and normal trigger mode, channel one enabled and vertical settings as shown below.

% Automatically configuring the instrument based on the input signal.autoSetup(myScope); myScope.AcquisitionTime = 0.01; myScope.WaveformLength = 2000; myScope.TriggerMode =' normal';myscope.Triggerlevel = 0.1;EnableChannel(MyScope,'Channel1');setVerticalCoupling (myScope,'Channel1','AC');setVerticalRange (myScope'Channel1', 5.0);

Getting a Waveform from Channel One

此函数启动启用通道上的采集。然后它等待采集完成并返回指定通道的波形。

waveformArray = getWaveform(myScope,'acquisition', true);% Plot the waveform.plot(waveformArray); xlabel('Samples');ylabel('Voltage');

Cleaning Up

Once you have finished configuring the instrument and retrieved data from it, you need to close the connection and remove it from the workspace.

disconnect(myScope); clearmyScope;