Macros
A macro is a single command, that repre
-
sents one or several other commands, de
-
pending on your definition. You can
define 25 macros of 40 characters in the
counter. One macro can address other
macros, but you cannot call a macro from
within itself (recursion). You can use
variable parameters that modify the
macro.
Use macros to do the following:
–
Provide a shorthand for complex com
-
mands.
–
Cut down on bus traffic.
Macro Names
You can use both commands and queries
as macro labels. The label cannot be the
same as common commands or queries.
If a macro label is the same as a CNT-8X
command, the counter will execute the
macro when macros are enabled
(*EMC81) and it will execute the
CNT-8X command when macros are dis-
abled (*EMC80).
Data Types within Macros
The commands to be performed by the
macro can be sent both as block and
string data.
String data is the easiest to use since you
don’t have to count the number of charac
-
ters in the macro. However, there are
some things you must keep in mind:
Both double quote (“) and single quote (‘)
can be used to identify the string data. If
you use a controller language that uses
double quotation marks to define strings
within the language (like BASIC) we rec
-
ommend that you use block data instead,
and use single quotes as string identifiers
within the macro.
+
When using string data for the
commands in a macro, remem
-
ber to use a different type of
string data identifiers for strings
within the macro. If the macro
should for instance set the input
slope to positive and select the
period function, you must type:
“:Inp:slope8pos;:Func8’PER81’”
or
‘:Inp:slope8pos;:Func8"PER81"’
Define Macro Command
*DMC assigns a sequence of commands
to a macro label. Later when you use the
macro label as a command, the counter
will execute the sequence of commands.
Use the following syntax:
*DMC <macro-label>, <commands>
n
Simple Macros
Example:
SEND→
*DMC8‘MyInputSetting’
#255:INP:IMP850;HYST81
;LEV80.55;:INP:HYST:AUTO
80;
This example defines a macro
MyInputSetting, which sets the impedance
to 50 Ω, sets the sensitivity to 1V, the
trigger level to +0.55V, and switches off
auto sensitivity and auto trigger level.
Introduction to SCPI
Macros 3-13