Specifications
5.1.2 Microsoft Visual Basic Script
Example
5.1.2.1 Application Configuration
Some operating systems may require that the Visual
Basic Scripting engine be installed before running the
application on a PC. To download a free copy of a Visual
Basic Scripting engine, visit the following web site:
http://msdn.microsoft.com/scripting/
5.1.2.2 Application Code
The application code is contained below. The developer
must save the file in a text file (i.e. using notepad) and
save it with the “.vbs” extension. The “.vbs” extension
will tell the operating system to execute the code using
the Visual Basic Scripting engine.
In order to run the application, double-click on the saved
.vbs file. The application can be run on a PC or copied
and run on the PNA Series network analyzer.
Option Explicit
' Shell objects
Dim app
Dim chan
Dim meas
Dim result
Dim message
Dim num_points
Dim i
' Connect to the PNA application on machine SLTSU044
Set app = CreateObject("AgilentPNA835x.Application",
"SLTSU044")
' Reset the analyzer to instrument preset
app.Reset
' Create S11 measurement
app.CreateMeasurement 1, "S11", 1
' Set chan variable to point to the active channel
Set chan = app.ActiveChannel
' Set meas variable to point to the active measurement
Set meas = app.ActiveMeasurement
' Setup the channel for a single trigger
chan.Hold True
app.TriggerSignal = 3
chan.TriggerMode = 1
' Make the PNA application visible
app.Visible = True
' Set channel parameters
chan.NumberOfPoints = 11
chan.StartFrequency = (1000000000)
chan.StopFrequency = (2000000000)
' Send a manual trigger to initiate a single sweep
chan.Single True
' Store the data in the "result" variable
result = meas.GetData(0, 1)
' Display the result
num_points = chan.NumberOfPoints
For i = 0 To num_points - 1
message = message & result(i) & vbCRLF
Next
if MsgBox(message, vbOKOnly, "S11(dB) - VBS COM
Example for PNA") then
Set chan = Nothing
app.quit
end if
5.1.2.3 Application Output
The figure below shows the displayed results when the
application is executed.
12