Using Macros

M9370A / M9371A / M9372A / M9374A / M9375A

Using Macros


Macros are executable programs that you write, load into the analyzer, and then run from the analyzer. You can have up to 25 macros set up to run on the analyzer.

How to Setup Macros

Using front-panel hardkey [softkey] buttons

Using Menus

  1. Press macro

  2. then [Macro Setup]

  1. Click Utility

  2. then Macro

  3. then Macro Setup

In the Macro Setup dialog box:

  1. Create an executable program and save it on the PNA hard drive. See SCPI or COM example programs in VBscript.

  2. Use a mouse or the front-panel 'down-arrow' to select a blank line below the last entry. (There may be NO entry.)

  3. Click Edit to start the Edit Macro Setup dialog.

  4. In the Macro Title box, type a descriptive title for your macro.

  5. Click Browse.

  6. Change Files of Type.

  7. Find and select your executable file. Change Files of Type if necessary.

  8. Click OK on the Edit Macro Setup dialog.

  9. Click OK on the Macro Setup dialog.

  10. Press macro to run. It may be necessary to first Preset the PNA to see your macro in the menu.

 

Macro Setup dialog box help

Macro setup allows you to create up to 25 macros that can be launched from the PNA application.

An external keyboard is required to enter the Macro Title and the Run string parameters.

To add a Macro, use a mouse or the front-panel 'down arrow' (NOT the 'Down' key) to select a blank line. Then click Edit.

Macro Title  Shows the titles that appear in the softkeys and menu when you press the Macro key. These titles are associated with the executable files and should be descriptive so you can easily identify them.

Macro Executable  Lists the complete path to the executable file. To follow the example of launching the Keysight PNA Series Home Page, the path to the executable could be "C:/Program Files/Internet Explorer/iexplore.exe.

Macro Runstring Parameters  Lists the parameters that get passed to the program that is referenced in the executable file. Again following the example of launching the PNA Series Home Page, you could assign the runstring parameters "http://www.Keysight.com/find/pna".

Edit  Invokes the Macro Edit dialog box.

Delete  Deletes the selected macro.

Up  Allows you to reorder the macros, moving the selected macro up one line. This order determines how they appear in the PNA Menu and in the softkeys and when you press the Macro front-panel key.

Down  Moves the selection down one line in the list of macros.

 

 

Macro Edit dialog box help

Macro Title  Add a title that appears in the softkeys and menu.

Macro Executable  Set the complete path to the macro executable file. Click Browse to navigate to the macro executable file and establish the complete path to the file.

Macro run string parameters  Optionally add parameters that are passed to the program referenced in the executable file.

See Macro Setup dialog box

 

How to Run Macros

Using front-panel
hardkey
[softkey] buttons

Using Menus

  1. Press Macro

  2. then select the macro to run

  1. Click Utility

  2. then Macro

  3. then select the macro to run

Macro Example

The following is an example Visual Basic Scripting (vbs) program that you can copy, install, and run on your PNA.

Note: Print these instructions if viewing in the analyzer. This topic will be covered by the Macro Setup dialog box.

  1. Copy the following code into a Notepad file.

  2. Save the file on the analyzer hard drive in the C:/Documents folder. Name the file FilterTest.vbs

  3. Close Notepad

  4. Setup the macro in the PNA

  5. Run the macro

Notepad is a text editor that is installed on all PCs that use a Microsoft Operating system. To launch Notepad on the analyzer:

  1. Click View, then click Title Bars

  2. Click the Start button on the windows taskbar

  3. Point to Programs, Accessories.

  4. Click Notepad

'Start copying here
'This program creates a S21 measurement, with Bandwidth
'markers for testing a 175MHz Bandpass filter
'It is written in VBscript using COM commands

Set PNA = CreateObject("AgilentPNA835x.Application")
PNA.Preset
Set chan=PNA.activechannel
Set meas=PNA.activemeasurement
Set limts = meas.LimitTest
Set trce = PNA.ActiveNAWindow.ActiveTrace

meas.ChangeParameter "S21",1
chan.StartFrequency = 45e6
chan.StopFrequency = 500e6
trce.ReferencePosition = 8
PNA.TriggerSignal = 3

'Do Test
for t=1 to 5
call measure
call compare
next
msgbox("Done Testing")

sub measure
msgbox("Connect Device " & t & " and press OK")
PNA.ManualTrigger True
meas.SearchFilterBandwidth
end sub

sub compare
BW = meas.FilterBW
if bw>6.5e7 then msgbox("Failed BW: " & BW)
Loss = meas.FilterLoss
if loss>5 then msgbox("Failed Loss: " & Loss)
end sub
'End copying here
 


Last Modified:

3-May-2012

Removed c models

17-Feb-2009

Added 25 limit

4-Sep-2008

Removed legacy content