382
MACROS
96-8000
June 1999
An infinite loop can be executed by eliminating the WHILE and expression. Thus,
DO1 ;
<statements>
END1 ;
Executes until the RESET key is pressed.
CAUTION! The following code can be confusing: WH [ #1 ] D01 ;
END1 ;
In the above, an alarm results indicating no then was found, here then refers to the D01. Change D01 (zero)
to DO1 (letter O).
COMMUNICATION W ITH E XTERNAL D EVICES - DPRNT[ ]
Macros allow additional capabilities to communicate with peripheral devices. One can do digitizing of parts,
provide runtime inspection reports, or synchronize controls with user provided devices. The commands pro-
vided for this are POPEN, DPRNT[ ] and PCLOS.
Communication preparatory commands
POPEN and PCLOS are not required on the HAAS mill. It has been included so that programs from different
controls can be ported to the HAAS. On some controls POPEN is required prior to using a DPRNT statement.
POPEN prepares the device on the serial port by sending it a DC2 code. PCLOS terminates communication
with external devices by sending it a DC4 code.
Formatted output
The DPRNT statement allows the programmer to send formatted text to the serial port. Any text and any
variable can be printed to the serial port. Variables can be formatted. The form of the DPRNT statement is as
follows:
DPRNT[ <text> <#nnnn[wf]>... ] ;
DPRNT must be the only command in the block. In the above, <text> is any character from A to Z or the letters
(+,-,/,*, and the space). When an asterisk is output, it is converted to a space. The <#nnnn[wf]> is a variable
followed by a format. The variable number can be any legal macro variable. The format [wf] is required and
consists of two digits within square brackets. Remember that macro variables are real numbers with a whole
part and a fractional part. The first digit in the format designates the total places reserved in the output for the
whole part. The second digit designates the total places reserved for the fractional part. The total places
reserved for output cannot be equal to zero or greater that eight. Thus the following formats are illegal:
[00] [54] [45] [36] /* not legal formats */