Read Waveform Data from Keysight DSO-X 1204A Oscilloscope Using IVI-C Driver
This example shows how to initialize the AgInfiniiVision
IVI-C driver, read a few properties from the driver, acquire waveform data using Keysight® Technologies DSO-X 1204A oscilloscope, and output the result in MATLAB®.
Requirements
To run this example, you must have the following installed on your computer:
Keysight IO libraries version 2021 or newer
Keysight InfiniiVision 1000, 1200, 2000, 3000, 4000, 6000, C7300, M924x and P924x X-Series Oscilloscope IVI driver version 2.8.2.0
For a walkthrough of this example, play the following video.
View Installed IVI-C Drivers and Connected Instruments
View a list of the IVI-C drivers and associated MATLAB drivers that are installed on your computer using ividriverlist
.
list = ividriverlist
list=17×4 table
VendorDriver MATLABDriver IVIClass SupportedModels
__________________ __________________ __________________ __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
1 "Ag3352x" "Ag3352x" "IVIFgen" {["33509B" "33510B" "33511B" "33512B" "33519B" "33520B" "33521A" "33521B" "33522A" "33522B" "33609A" "33610A" "33611A" "33612A" "33619A" "33620A" "33621A" "33622A" "EDU33211A" "EDU33212A" ]}
2 "AgInfiniiVision" "AgInfiniiVision" "IVIScope" {["C7302" "C7302C" "C7304" "C7304C" "C7312" "C7312C" "C7314" "C7314C" "C7322" "C7322C" "C7324" "C7324C" "C7332" "C7332C" "C7334" "C7334C" "C7352" "C7352C" "C7354" "C7354C" "DSO-X 1102A" "DSO-X 1102G" "DSO-X 2002A" "DSO-X 2004A" "DSO-X 2012A" "DSO-X 2014A" "DSO-X 2022A" "DSO-X 2024A" "DSO-X 3012A" "DSO-X 3012T" "DSO-X 3014A" "DSO-X 3014T" "DSO-X 3022T" "DSO-X 3024A" "DSO-X 3024T" "DSO-X 3032A" "DSO-X 3032T" "DSO-X 3034A" "DSO-X 3034T" "DSO-X 3052A" "DSO-X 3052T" "DSO-X 3054A" "DSO-X 3054T" "DSO-X 3102A" "DSO-X 3102T" "DSO-X 3104A" "DSO-X 3104T" "DSO-X 4022A" "DSO-X 4024A" "DSO-X 4032A" "DSO-X 4034A" "DSO-X 4052A" "DSO-X 4054A" "DSO-X 4104A" "DSO-X 4154A" "DSO-X 6002A" "DSO-X 6004A" "DSOX1202A" "DSOX1202G" "DSOX1204A" "DSOX1204G" "EDU-X 1002A" "EDU-X 1002G" "EDUX1052A" "EDUX1052G" "M9241A" "M9242A" "M9243A" "MSO-X 2002A" "MSO-X 2004A" "MSO-X 2012A" "MSO-X 2014A" "MSO-X 2022A" "MSO-X 2024A" "MSO-X 3012A" "MSO-X 3012T" "MSO-X 3014A" "MSO-X 3014T" "MSO-X 3022T" "MSO-X 3024A" "MSO-X 3024T" "MSO-X 3032A" "MSO-X 3032T" "MSO-X 3034A" "MSO-X 3034T" "MSO-X 3052A" "MSO-X 3052T" "MSO-X 3054A" "MSO-X 3054T" "MSO-X 3102A" "MSO-X 3102T" "MSO-X 3104A" "MSO-X 3104T" "MSO-X 4022A" "MSO-X 4024A" "MSO-X 4032A" "MSO-X 4034A" "MSO-X 4052A" "MSO-X 4054A" "MSO-X 4104A" "MSO-X 4154A" "MSO-X 6002A" "MSO-X 6004A" "P9241A" "P9242A" "P9243A"]}
3 "AgRfSigGen" "AgRfSigGen" "IVIRfSigGen" {["E4428C" "E4438C" "E8241A" "E8244A" "E8247C" "E8251A" "E8254A" "E8257C" "E8257D" "E8257N" "E8267C" "E8267D" "E8663B" "E8663D" "N5166B" "N5171B" "N5172B" "N5173B" "N5181A" "N5181B" "N5182A" "N5182B" "N5182N" "N5183A" "N5183B" "N5183N" ]}
4 "IviACPwr" "IviACPwr" "IVIACPwr" {["" ]}
5 "IviCounter" "IviCounter" "IVICounter" {["" ]}
6 "IviDCPwr" "IviDCPwr" "IVIDCPwr" {["" ]}
7 "IviDigitizer" "IviDigitizer" "IVIDigitizer" {["" ]}
8 "IviDmm" "IviDmm" "IVIDmm" {["" ]}
9 "IviDownconverter" "IviDownconverter" "IVIDownconverter" {["" ]}
10 "IviFgen" "IviFgen" "IVIFgen" {["" ]}
11 "IviPwrMeter" "IviPwrMeter" "IVIPwrMeter" {["" ]}
12 "IviRfSigGen" "IviRfSigGen" "IVIRfSigGen" {["" ]}
13 "IviScope" "IviScope" "IVIScope" {["" ]}
14 "IviSpecAn" "IviSpecAn" "IVISpecAn" {["" ]}
15 "IviSwtch" "IviSwtch" "IVISwtch" {["" ]}
16 "IviUpconverter" "IviUpconverter" "IVIUpconverter" {["" ]}
⋮
List the IVI-C instruments that are connected to your computer using ividevlist
with a timeout value of 40 seconds. Specifying a value for the timeout is optional. You can try a larger timeout value if your instrument does not appear within the default timeout period of 30 seconds.
devlist = ividevlist("Timeout",40)
devlist=1×5 table
MATLABDriver ResourceName VendorDriver Model SerialNumber
_________________ ____________________________________________ _________________ ___________ ____________
1 "AgInfiniiVision" "USB0::0x2A8D::0x0386::CN59216227::0::INSTR" "AgInfiniiVision" "DSOX1204A" "CN59216227"
In this example, you use the AgInfiniiVision
MATLAB driver.
Connect to Instrument
Connect to the DSO-X 1204A oscilloscope using ividev
with the instrument's MATLAB driver name and resource name.
dev = ividev("AgInfiniiVision","USB0::0x2A8D::0x0386::CN59216227::0::INSTR")
dev = AgInfiniiVision with properties: Model: "DSOX1204A" Manufacturer: "KEYSIGHT TECHNOLOGIES" SerialNumber: "CN59216227" ResourceName: "USB0::0x2A8D::0x0386::CN59216227::0::INSTR" VendorDriver: "AgInfiniiVision" Simulate: 0 ChannelIDs: ["Channel1", "Channel2", "Channel3", "Channel4"] DigitalChannelIDs: [] MathFunctionIDs: ["Math1", "Math2"] MeasurementIDs: ["Channel1", "Channel2", "Channel3", "Channel4", "FUNC", ... ] SerialBusIDs: [] WaveGenIDs: "WaveGen1" InherentIVIAttributes: [1x1 InherentIVIAttributes] Acquisition: [1x1 Acquisition] Channel: [1x4 Channel] InstrumentSpecific: [1x1 InstrumentSpecific] Trigger: [1x1 Trigger] WaveformMeasurement: [1x1 WaveformMeasurement] Show all functions
Get General Instrument Properties
Query information about the driver and its attributes. You can explore properties and sub-properties of the object by clicking on the property links from the object display output.
dev.InherentIVIAttributes
ans = InherentIVIAttributes with properties: AdvancedSessionInformation: [1x1 AdvancedSessionInformation] DriverCapabilities: [1x1 DriverCapabilities] DriverIdentification: [1x1 DriverIdentification] InstrumentIdentification: [1x1 InstrumentIdentification] UserOptions: [1x1 UserOptions]
dev.InherentIVIAttributes.DriverIdentification
ans = DriverIdentification with properties: SpecificDriverClassSpecMajorVersion: 4 SpecificDriverClassSpecMinorVersion: 1 SpecificDriverDescription: "IVI driver for the Keysight 1000X, 1200X, 2000X, 3000X, 4000X, 6000X, C7300, M924x and P924x Oscilloscope families. [Compiled for 64-bit.]" SpecificDriverPrefix: "AgInfiniiVision" SpecificDriverRevision: "2.8.2.0" SpecificDriverVendor: "Keysight Technologies"
Read Waveform from Oscilloscope
Reset the instrument to a known state and automatically configure the measurement parameters.
reset(dev) autoSetup(dev)
Get the actual record length, which is the number of points that the oscilloscope acquires.
recordLength = actualRecordLength(dev)
recordLength = 62500
Enable channel 1 on the oscilloscope.
dev.Channel("Channel1").ChannelEnabled = true;
Explore the properties of channel 1.
dev.Channel("Channel1")
ans = Channel with properties: RepCapID: "Channel1" ChannelEnabled: 1 InputImpedance: 1e+06 (Ohms) MaximumInputFrequency: 7e+07 (Hz) ProbeAttenuation: 10 ProbeSenseValue: 10 VerticalCoupling: 1 VerticalOffset: 12.6 (Volts) VerticalRange: 40 (Volts)
Set the channel probe attenuation to 1.
dev.Channel("Channel1").ProbeAttenuation = 1;
Specify the sweep time duration in milliseconds.
maxTimeMilliseconds = 1e3;
Read a waveform from the oscilloscope.
[waveformArray,actualPoints] = readWaveform(dev,"Channel1",recordLength,maxTimeMilliseconds);
Visualize Data and Display Any Errors
Get the number elements in the waveform array and verify that they match the actual number of points returned by the readWaveform
function.
n = numel(waveformArray);
Calculate the time in between samples and create a time vector.
dt = dev.Acquisition.HorizontalTimePerRecord/dev.Acquisition.HorizontalRecordLength; t = (0:n-1) * dt;
Display the waveform.
plot(t,waveformArray); grid on; xlabel('Time (s)'); ylabel('Volts (V)');
If there are any errors, query the driver to retrieve and display them.
errorNum = 1; while (errorNum ~= 0) [errorNum,errorMsg] = error_query(dev); fprintf('ErrorQuery: %d, %s\n',errorNum,errorMsg); end
ErrorQuery: 0, No error
Clean Up
Disconnect and clear the ividev
object from the workspace.
clear dev
See Also
ividriverlist
| ividevlist
| ividev