116
96-8000 Rev AC
May 2010
Formatted Output
The DPRNT statement allows the programmer to send formatted text to the se
-
rial port. Any text and any variable can be printed to the serial port. The form of
the DPRNT statement is as follows: DPRNT [<text> <#nnnn[wf]>... ] ;
DPRNT must be the only command in the block. In the previous example,
<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 macro variable. The for
-
mat [wf] is required and consists of two digits within square brackets. Remem
-
ber 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 */
A decimal point is printed out between the whole part and the fractional part.
The fractional part is rounded to the least significant place. When zero places
are reserved for the fractional part, then no decimal point is printed out. Trail
-
ing zeros are printed if there is a fractional part. At least one place is reserved
for the whole part, even when a zero is used. If the value of the whole part has
fewer digits than have been reserved, then leading spaces are output. If the
value of the whole part has more digits than has been reserved, then the field
is expanded so that these numbers are printed.
A carriage return is sent out after every DPRNT block.
DPRNT[ ] Examples
Code
Output
N1 #1= 1.5436 ;
N2 DPRNT[X#1[44]*Z#1[03]*T#1[40]] ;
X1.5436 Z 1.544 T 1
N3 DPRNT[***MEASURED*INSIDE*DIAM
ETER***] ;
MEASURED INSIDE DIAMETER
N4 DPRNT[] ;
(no text, only a carriage return)
N5 #1=123.456789 ;
N6 DPRNT[X-#1[25]] ;
X-123.45679 ;
Execution
DPRNT statements are executed at block interpretation time. This means that
the programmer must be careful about where the DPRNT statements appear in
the program, particularly if the intent is to print out.
G103 is useful for limiting lookahead. If you wanted to limit lookahead interpre
-
tation to one block, you would include the following command at the beginning
of your program: (This actually results in a two block lookahead.)
G103 P1;
Summary of Contents for 96-8000
Page 15: ...6 96 8000 Rev AC May 2010 Mill Warning Decals ...
Page 16: ...7 96 8000 Rev AC May 2010 Safety Lathe Warning Decals ...
Page 41: ...32 96 8000 Rev AC May 2010 ...
Page 93: ...84 96 8000 Rev AC May 2010 ...
Page 129: ...120 96 8000 Rev AC May 2010 ...
Page 133: ...124 96 8000 Rev AC May 2010 ...
Page 268: ......
Page 269: ......