HP 53181A Programming Manual page 111

Frequency counter
Hide thumbs Also See for 53181A:
Table of Contents

Advertisement

Programming Your Counter for Remote Operation
How to Program the Counter to Define Macros
How to Program the Counter to Define Macros
A macro is a user defined command that can be used to replace one or many
Counter commands. There are two good reasons to use macros in place of other
commands:
1. They provide a mnemonic for long or complex commands.
2. They reduce the overhead associated with sending long
commands.
For example, if you often want the Counter to display the limit graph, you can
replace the following string of commands with a macro called 'limitresult' (you can
provide any name you wish).
:DISP:MENU OFF;:DISP:TEXT:FEED 'CALC2';
:CALC2:LIM:STATE ON;:CALC2:LIM:DISP GRAPH
Anytime you wanted to display the limit graph, you would just send the command
'limitresult'.
To assign the macro 'limitresult' to the above command sequence, you would send
the following:
*DMC 'limitresult',#280:DISP:MENU OFF;
:DISP:TEXT:FEED 'CALC2';:CALC2:LIM:STATE ON;
:CALC2:LIM:DISP GRAPH
The #2 indicates that the next two characters contain the length of the command, in
this example, 80 characters. To program a macro, you need to know the length of
characters in the command. This can be tedious and is prone to users counting
incorrectly. The "To Use Macros" sample programs on pages 3- 73 and 3-88, can be
used to help set up macros and perform the counting for you.
A macro also lets you send variable parameters along with the name. For example,
you could have a macro that sets up a measurement channel. One of the variables
may be the input impedance, either 50 Ohms or
1 Megaohm. To program this, you would send the macro name along with the
impedance value. To assign a variable inside the macro definition, you would
replace the normal parameter with a $ followed by a number from 1 to 9. Up to 9
variables can be assigned. When sending the macro, the
3-53

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents