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 counter
command, the counter will execute the
macro when macros are enabled
(*EMC81), and it will execute the
counter 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, remember
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‘ECL_RiseTime’,
#268:INP:LEV:AUTO8ON;REL
820;:INP:IMP850;COUP8DC;
:INP2:LEV:AUTO8ON;REL880
This example defines a macro
“ECL_RiseTime”, which sets the imped
-
ance to 50 W, the coupling to DC, and the
relative trigger levels to 20 % and 80 %,
in order to make the necessary prepara
-
tions for measuring rise time of ECL
logic signals on Input A.
Introduction to SCPI
Macros 3-13