HP (Hewlett-Packard) 132A Water Dispenser User Manual


 
Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Programming Guide 3-53
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 first parameter would be assigned to the $1 and all
occurrences of $1 in the macro. The second parameter would be assigned to $2
and so on. Here is what the macro called setimp would look like. It changes the
impedance on channel 1 to the value assigned to $1 in the macro command.
*DMC setimp,#212:INP1:IMP $1
To change the impedance to 50 ohms, send:
setimp 50
The above is a very simple example. Macros are best used for a long sequence of
commands. A good use for macros is changing the display from one format to
another. To change to the limit graph, the following commands must be sent:
:DISP:MENU OFF
:DISP:TEXT:FEED CALC2
:CALC2:LIM:STATE ON
:CALC2:LIM:DISP GRAPH
:CALC:IMM
These commands can all be replaced by a macro called limitdisplay, defined as
follows:
*DMC limitdisplay ,#290:DISP:MENU OFF;
:DISP:TEXT:FEED CALC2;:CALC2:LIM:STATE ON;
:CALC2:LIM:DISP GRAPH;:CALC:IMM
There is a finite amount of memory available in the Counter for storing macros. If
you find that you are running low on memory,
you can shorten the commands as follows:
1. Do not send the complete path unless it is necessary.
2. Use 1 and 0 instead of ON and OFF for <Boolean> parameters.
3. Use the short form for keywords, INP for INPut, FUNC for FUNCtion
and so on.
The above example for switching to the limit display can be significantly
decreased in length using these shortcuts: