Intermec IF2 Basic Reader Interface Programmer's Reference Manual (BRI version - Page 126

Creating a Command Macro, Executing a Command Macro, Creating a Parameter Macro

Page 126 highlights

Chapter 4 - BRI Commands Creating a Command Macro You create a command macro, which contains both a command and all its parameters, with the SET command. For example: SET MYREADMACRO="READ TAGID WHERE INT(20,2)=2000" Follow these guidelines when naming a macro: • The name is an alphanumeric string that can be as short as one character; there is no length limit for the name. • You cannot use BRI reserved keywords as macro names. For a list of reserved keywords, see "Reserved Keywords" on page 17. • The first character must be a letter (A to Z or a to z). • The first character cannot be a number (0 to 9). If the macro contains [LITERAL] parameters, which must be enclosed in double quotes, you must use the \ character to escape the embedded double quotes. To execute a command macro, see the next section, "Executing a Command Macro." Executing a Command Macro You execute a command macro by typing the name of the macro preceded by a $. Suppose a macro MYREADMACRO was defined, you invoke it with this command: $MYREADMACRO The macro MYREADMACRO is expanded by the BRI and replaced with the text string stored in the macro MYREADMACRO. Creating a Parameter Macro Suppose these are the parameters for a READ command used several times in your application: READ "TAG ID:" ,HEX(0,8), "NAME:", STRING(18,20) WHERE INT(18)=1 AND INT(22) != 100 AND STRING(30)="ADDRESS" You can store all those parameters in a parameter macro called MYREADPARAMS with this command: SET MYREADPARAMS ="\"TAG ID:\", HEX(0,8), \"NAME:\",STRING(18,20) WHERE INT(18)=1 AND INT(22) != 100 AND STRING(30)=\"ADDRESS\"" Note how the \ character is used to escape the embedded double quotes for the [LITERAL] parameters. To execute a READ command using this parameter macro, see the next section, "Executing a Command With a Parameter Macro." 114 Basic Reader Interface Programmer Reference Manual

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146

Chapter 4 — BRI Commands
114
Basic Reader Interface Programmer Reference Manual
Creating a Command Macro
You create a command macro, which contains both a command and all its
parameters, with the SET command. For example:
SET MYREADMACRO=”READ TAGID WHERE INT(20,2)=2000”<CRLF>
Follow these guidelines when naming a macro:
The name is an alphanumeric string that can be as short as one character; there is
no length limit for the name.
You cannot use BRI reserved keywords as macro names. For a list of reserved
keywords, see
“Reserved Keywords” on page 17
.
The first character must be a letter (A to Z or a to z).
The first character cannot be a number (0 to 9).
If the macro contains [LITERAL] parameters, which must be enclosed in double
quotes, you must use the \ character to escape the embedded double quotes.
To execute a command macro, see the next section, “Executing a Command Macro.”
Executing a Command Macro
You execute a command macro by typing the name of the macro preceded by a
$
.
Suppose a macro MYREADMACRO was defined, you invoke it with this command:
$MYREADMACRO
The macro MYREADMACRO is expanded by the BRI and replaced with the text
string stored in the macro MYREADMACRO.
Creating a Parameter Macro
Suppose these are the parameters for a READ command used several times in your
application:
READ “TAG ID:” ,HEX(0,8), “NAME:”, STRING(18,20) WHERE INT(18)=1
AND INT(22) != 100 AND STRING(30)=”ADDRESS”
You can store all those parameters in a parameter macro called MYREADPARAMS
with this command:
SET MYREADPARAMS =“\“TAG ID:\”, HEX(0,8),
\“NAME:\”,STRING(18,20) WHERE INT(18)=1 AND INT(22) != 100 AND
STRING(30)=\”ADDRESS\””
Note how the \ character is used to escape the embedded double quotes for the
[LITERAL] parameters.
To execute a READ command using this parameter macro, see the next section,
“Executing a Command With a Parameter Macro.”