Introduction to SCPI

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

(*EMC￿1) and it will execute the

CNT-8X command when macros are dis- abled (*EMC￿0).

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:slope￿pos;:Func￿’PER￿1’”

or

‘:Inp:slope￿pos;:Func￿"PER￿1"’

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>

￿Simple Macros

Example:

SEND→ *DMC￿‘MyInputSetting’ #255:INP:IMP￿50;HYST￿1 ;LEV￿0.55;:INP:HYST:AUTO ￿0;

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.

Macros 3-13

Page 33
Image 33
Fluke PM6681R, PM6685R manual Macro Names, Data Types within Macros, Define Macro Command, Simple Macros