Generate AM Waveforms on Keysight 3352x Waveform Generator Using IVI-C Driver
This example shows how to initialize the Ag3352x
IVI-C driver, read a few properties from the driver, generate waveforms using the Keysight® Technologies 3352x waveform generator, 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 335XX / 336XX Function / Arbitrary Waveform Generator IVI driver version 2.4.2.0
View Installed IVI-C Drivers
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" {["" ]}
⋮
In this example, you use the Ag3352x
MATLAB driver.
Connect to Instrument
Connect to a simulated Keysight waveform generator using ividev
with the instrument's MATLAB driver name and resource name. This example uses the Ag3352x
driver's simulation mode to run without physically connecting any hardware. Since simulation mode is enabled, the resource name can be specified as empty.
dev = ividev("Ag3352x","",Simulate=true)
dev = Ag3352x with properties: Model: "33522B" Manufacturer: "Agilent Technologies" SerialNumber: "" ResourceName: "" VendorDriver: "Ag3352x" Simulate: 1 ChannelIDs: ["Channel1", "Channel2"] InherentIVIAttributes: [1x1 InherentIVIAttributes] AM: [1x2 AM] Arbitrary: [1x2 Arbitrary] Calibration: [1x1 Calibration] Channel: [1x2 Channel] Display: [1x1 Display] FM: [1x2 FM] Memory: [1x1 Memory] Output: [1x2 Output] StandardWaveform: [1x2 StandardWaveform] StateStorage: [1x1 StateStorage] System: [1x1 System] Trigger: [1x2 Trigger] 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 output display.
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: 3 SpecificDriverClassSpecMinorVersion: 0 SpecificDriverDescription: "IVI driver for the Agilent 33500/33600 family of Function/Arbitrary Waveform Generators [Compiled for 64-bit.]" SpecificDriverPrefix: "Ag3352x" SpecificDriverRevision: "2.4.2.0" SpecificDriverVendor: "Agilent Technologies"
dev.InherentIVIAttributes.InstrumentIdentification
ans = InstrumentIdentification with properties: InstrumentFirmwareRevision: "Sim2.4.2.0" InstrumentManufacturer: "Agilent Technologies" InstrumentModel: "33522B"
Create AM Waveform
Clear all event registers and the error queue.
statusClear(dev)
Reset the instrument to a known state.
reset(dev)
Configure standard waveform generation. Set the amplitude to 5 V, DC offset to 0 V, frequency to 1 MHz, and start phase to 0 degrees.
configureStandardWaveform(dev,"Channel1","WFM_SINE",5,0,1e6,0)
Enable amplitude modulation.
configureAMEnabled(dev,"Channel1",true)
Set the source of the AM waveform as internal.
configureAMSource(dev,"Channel1","AM_INTERNAL")
Configure internal amplitude modulating waveform source.
depth = 50;
amFrequency = 10000;
configureAMInternal(dev,depth,"AM_INTERNAL_SINE",amFrequency)
Enable signal output.
configureOutputEnabled(dev,"Channel1",true)
Display Any Errors from Driver
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