1 0 3
96-8000 rev R June 2007
Macros
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. 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 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 */
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.
Trailing 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*DIAMETER***] ; 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 interpretation 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;
To cancel the lookahead limit, change the command to G103 P0. G103 cannot be used when cutter compensation
is active.
Editing
Improperly structured or improperly placed macro statements will generate an alarm. Be careful when editing
expressions; brackets must be balanced.
The DPRNT[ ] function can be edited much like a comment. It can be deleted, moved as a whole item, or individual
items within the bracket can be edited. Variable references and format expressions must be altered as a whole
entity. If you wanted to change [24] to [44], place the cursor so that [24] is highlighted, enter [44] and press the write
key. Remember, you can use the jog handle to maneuver through long DPRNT[ ] expressions.
Addresses with expressions can be somewhat confusing. In this case, the alphabetic address stands alone. For
instance, the following block contains an address expression in X:
G1 G90 X [COS [90]] Y3.0;
CORRECT
Содержание Mill
Страница 12: ...96 8000 rev R June 2007 Safety 5 ...
Страница 14: ...96 8000 rev R June 2007 Safety 7 LATHE WARNING DECALS ...
Страница 15: ...8 Safety 96 8000 rev R June 2007 ...
Страница 17: ...10 Introduction 96 8000 rev R June 2007 ...
Страница 117: ...110 4 5 Axis Programming 96 8000 rev R June 2007 ...
Страница 199: ...Settings 192 96 8000 rev R June 2007 ...
Страница 213: ...206 Maintenance 96 8000 rev R June 2007 ...