Main Content

Configure Output Signal on Keysight RF Signal Generator Using IVI-C Driver

This example shows how to initialize the AgRfSigGen IVI-C driver, read a few properties from the driver, configure an output signal using a Keysight™ Technologies RF Signal 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 RF Signal Generators IVI and MATLAB instrument drivers version 1.9.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 AgRfSigGen MATLAB driver.

Connect to Instrument

Connect to a simulated Keysight RF signal generator using ividev with the instrument's MATLAB driver name and resource name. This example uses the AgRfSigGen 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("AgRfSigGen","",Simulate=true)
dev = 
  AgRfSigGen with properties:

                    Model: "E4428C" 
             Manufacturer: "Keysight Technologies" 
             SerialNumber: "" 
             ResourceName: "" 
             VendorDriver: "AgRfSigGen" 
                 Simulate: 1 

              ArmAlarmIDs: [] 
             ArmSourceIDs: [] 
                 EventIDs: ["Event!!LAN0", "Event!!LAN1", "Event!!LAN2", "Event!!LAN3", ... ] 
           LFGeneratorIDs: "LFG1" 
          TriggerAlarmIDs: "TriggerAlarm!!ALARM0" 
         TriggerSourceIDs: ["TriggerSource!!LAN0", "TriggerSource!!LAN1", "TriggerSource!!LAN2", ... ] 

    InherentIVIAttributes: [1x1 InherentIVIAttributes] 
                      ALC: [1x1 ALC] 
         AnalogModulation: [1x1 AnalogModulation] 
             ARBGenerator: [1x1 ARBGenerator] 
                      Arm: [1x1 Arm] 
                     CDMA: [1x1 CDMA] 
        DigitalModulation: [1x1 DigitalModulation] 
                  Display: [1x1 Display] 
                     DSIM: [1x1 DSIM] 
                    Event: [1x8 Event] 
                 EventLog: [1x1 EventLog] 
                       IQ: [1x1 IQ] 
              LFGenerator: [1x1 LFGenerator] 
                      Ptp: [1x1 Ptp] 
           PulseGenerator: [1x1 PulseGenerator] 
          PulseModulation: [1x1 PulseModulation] 
      ReferenceOscillator: [1x1 ReferenceOscillator] 
                       RF: [1x1 RF] 
                   Status: [1x1 Status] 
                    Sweep: [1x1 Sweep] 
                   System: [1x1 System] 
                     TDMA: [1x1 TDMA] 
                     Time: [1x1 Time] 
                  Trigger: [1x1 Trigger] 
             FriendlyName: (Currently not accessible)
        ActiveLFGenerator: "LFG1" 

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: 2 
    SpecificDriverClassSpecMinorVersion: 0 
              SpecificDriverDescription: "IVI Driver for Keysight Technologies RF Signal Generator [Compiled for 64-bit.]" 
                   SpecificDriverPrefix: "AgRfSigGen" 
                 SpecificDriverRevision: "1.9.2.0" 
                   SpecificDriverVendor: "Keysight Technologies" 

dev.InherentIVIAttributes.InstrumentIdentification
ans = 
  InstrumentIdentification with properties:

    InstrumentFirmwareRevision: "Sim1.9.2.0" 
        InstrumentManufacturer: "Keysight Technologies" 
               InstrumentModel: "E4428C" 

Configure and Output Carrier Signal

Specify and configure frequency and amplitude (power level) of the RF output signal as 1GHz/0dBm (1 milliwatt).

reset(dev);
frequency = 1E9;
powerLevel = 0;
outputEnabled = true;
configureRF(dev,frequency,powerLevel)

Enable RF output signal.

configureOutputEnabled(dev,outputEnabled)

Disable AM, FM, and PM modes.

analogModulationDisableAll(dev)

Enable Amplitude Modulation (AM) Output

Initialize the buffer size.

bufferSize = 256;

Get the analog modulation source name.

Lfg = getLFGeneratorName(dev,1,bufferSize)
Lfg = 
"LFG1"

Set Lfg as amplitude modulation (AM) source.

dev.AnalogModulation.AM.AMSource = Lfg;

Set Lfg as active LF generator.

dev.ActiveLFGenerator = Lfg;

Generate a 2 kHz sine waveform modulation signal.

configureLFGenerator(dev,2000,"LF_GENERATOR_WAVEFORM_SINE")

Enable amplitude modulation (AM) mode.

dev.AnalogModulation.AM.AMEnabled = 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

| |

Related Topics