Last Updated: August 29, 2007
This topic provides an example of how use the Spectrum Monitor.
For more information on the conventions used in the programming examples click here.
Ensure that the wireless device is connected to the test set, and in a suitable test mode.
Set up the spectrum monitor parameters as needed using the SETup:SMONitor commands.
Use the INITiate:SMONitor[:ON] command to start the spectrum monitor.
Use the FETCh:SMONitor? commands to obtain spectrum monitor results.
This programming example can be used on the GPIB, LAN and USB interfaces by using the correct VISA Address. For more information on VISA Addresses refer to Step 2. Open the test set connection using the IO library.
Option Explicit On
Option Strict On
Imports Ivi.Visa.Interop
Module modSpectrumMonitor
Public Sub SpectrumMonitor()
' This programming example assumes the wireless device is connected to the test set,
' and in a suitable test mode.
Dim ResManager As New ResourceManager
Dim TestSet As New FormattedIO488
Dim FetchSmonitorParameters As Array
Dim FetchSmonitorPeaks As Array
Try
' Open the connection to the test set
TestSet.IO = CType(ResManager.Open("GPIB0::14::INSTR"), IMessage)
' Clear the interface buffer.
TestSet.IO.Clear()
Console.WriteLine(ControlChars.NewLine & "Using Spectrum Monitor...")
'***Set up measurement parameters***
' Set spectrum monitor trigger arm to single.
TestSet.WriteString("SETup:SMONitor:CONTinuous OFF")
'Set multi-measurement state to on and set multi-measurement count to 20.
TestSet.WriteString("SETup:SMONitor:COUNt 20")
' Set spectrum monitor trigger source to immediate.
TestSet.WriteString("SETup:SMONitor:TRIGger:SOURce IMMediate")
' Set VISA timeout to 10 seconds. This timeout should be longer than the
' following measurement timeout value.
TestSet.IO.Timeout = 10000
' Set spectrum monitor timeout to 5 seconds.
TestSet.WriteString("SETup:SMONitor:TIMeout 5S")
' Set spectrum monitor frequency span to 20 MHz.
TestSet.WriteString("SETup:SMONitor:FREQuency:SPAN 20MHz")
'***INITiate and FETCh measurements***
' Initiate the spectrum monitor.
TestSet.WriteString("INITiate:SMONitor")
' Fetch the spectrum monitor measurement parameters.
TestSet.WriteString("FETCh:SMONitor:TRACe:PARameters?")
FetchSmonitorParameters = CType(TestSet.ReadList(), Array)
' Print the parameters used for the spectrum monitor measurement.
Console.WriteLine(ControlChars.NewLine & "Spectrum Monitor Parameters:")
Console.WriteLine("Start Frequency Offset (Hz) = " & CStr(FetchSmonitorParameters.GetValue(1)))
Console.WriteLine("Step Frequency (Hz) = " & CStr(FetchSmonitorParameters.GetValue(2)))
Console.WriteLine("Number of bins = " & CStr(FetchSmonitorParameters.GetValue(3)))
' Query the integrity indicator and a frequency/power result
' pair for the highest peak on the trace.
TestSet.WriteString("FETCh:SMONitor:TRACe:PEAKs? 1")
FetchSmonitorPeaks = CType(TestSet.ReadList(), Array)
'***Print measurement results***
Console.WriteLine(ControlChars.NewLine & "Spectrum Monitor Results:")
Console.WriteLine("Integrity Indicator = " & CStr(FetchSmonitorPeaks.GetValue(0)))
Console.WriteLine("Maximum Peak Frequency (Hz) = " & CStr(FetchSmonitorPeaks.GetValue(1)))
Console.WriteLine("Maximum Peak Power (dBm) = " & CStr(FetchSmonitorPeaks.GetValue(2)))
Console.WriteLine(ControlChars.NewLine & "Spectrum Monitor Complete.")
Catch ex As Exception
MessageBox.Show("The following error occurred in the Spectrum Monitor" & ControlChars.CrLf & ex.Message, "Program Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
'***Post test clean up***
' Turn off the spectrum monitor.
TestSet.WriteString("INITiate:SMONitor:OFF")
' Close IO interface to test set
TestSet.IO.Close()
End Sub
End Module