
8 GCS Commands
C-863.12 Mercury Controller
MS249E
Version: 1.2.1
131
Send:
ADD ${3Z} $A $B
Send:
VAR?
Receive:
A=468
B=123
AWORKS=591
WORKS=591
3Z=WORKS
Example 3:
The macros below can be used to create a "flashing light"
with LEDs that are connected to the digital output lines of
the controller. $1 and $2 are values of local variables and
must be specified as arguments of MAC START or MAC
NSTART command when starting the macros (see below).
DIO 0 <bitmask>: Sets the output channels according to
<bitmask>. For example, "DIO 0 5" activates channels 1 and
3 and deactivates all other channels (5 is 0000 0101 in
binary notation).
To implement the "flashing light", do the following steps:
1. Write the "STEPS" macro:
MAC BEG STEPS
DIO 0 $1
ADD 1 $1 1
DEL $2
JRC -3 VAR? 1 <= 15
ADD 1 $1 -1
DIO 0 $1
DEL $2
JRC -3 VAR? 1 > 0
MAC END
2. Write the "TEST" macro:
MAC BEG TEST
MAC START STEPS 0 $1
ADD 1 $1 10
JRC -2 VAR? 1 < 110
VAR 1 10
ADD 2 $2 -1
JRC -5 VAR? 2 > 0
MAC END
3. Start the TEST macro with arguments that define the
variable values $1 and $2: