Count – Measurement Computing Micro 488/EX rev.2.1 User Manual
Page 89
Section 5
Command Descriptions
5.19
COUNT
The COUNT command returns the loop count, appended with the serial output
terminator(s), of the last invoked Macro buffer. The number returned is the remaining
number of loops left to execute. It, therefore, is a decrementing count. If Macro 1
requests a COUNT then calls Macro 0, any subsequent COUNT requests made by Macro
1 will return the Macro 0 loop COUNT. The following contents of Macro 1's buffer
should illustrate this…
MACRO 1
Creates Macro Buffer #1
COUNT
This will return Macro #1's loop count
DOMACRO 0
This command executes Macro #0
COUNT
This will return Macro #0's loop count since it
was the last Macro to be invoked
ENDM01
If Macro #1, in the previous example, was invoked multiple times, each time the
loop counts will be reported as described. This is due to the fact that looping is a re-
invocation of the looped Macro. This command is only valid when contained within a
Macro. Execution outside of a Macro will generate an 'INVALID COMMAND' error.
SYNTAX
COUNT
RESPONSE
numeric loop count (1 to 255) of last invoked Macro buffer.
MODE Any
BUS STATES
None
EXAMPLE
10 PRINT #1,"MACRO"
Build Macro #0
20 PRINT #1,"COMMENT 'Loop Number =\'"
30 PRINT #1,"COUNT"
40 PRINT #1,"ENDM"
50 PRINT #1,"DOMACRO0,5"
Execute the Macro five times
60 FOR N = 1 TO 5
70 INPUT #1,L$:PRINT L$
Read Comment & Count
80 NEXT N