Programming Example For Formatting A Single Number; Programming Example For Formatting Three Numbers - Siemens SINUMERIK 840D sl Programming Manual

Measuring cycles
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Miscellaneous functions
7.1 Log measurement results
Formatting more than one number:
• Up to 10 numbers can be formatted; the actual number of numbers to be formatted is
• The cycle takes the numbers from consecutive R parameters, e.g. R11 to R20.
• It is possible to start with any R parameter. It is passed to the cycle on calling (PAR5).
• The number of decimal places is specified in the same way as for formatting one number
• The return values are in the predefined variables _TXT[0] up to _TXT[9] (variable field
Parameter
Parameter
PAR1
PAR2
PAR3
PAR4
PAR5
7.1.3.8

Programming example for formatting a single number

The value of one variable of type REAL is to be formatted for 2 decimal places and
displayed:
DEF STRING[12] TEXTVAR
DEF REAL VAR1
VAR1=100/$PI
CYCLE118(VAR1,2,TEXTVAR)
MSG("VAR1:"<<VAR1<<" TEXTVAR="<<TEXTVAR)
M0
M30
7.1.3.9

Programming example for formatting three numbers

The intention is to format the values of R parameters R11 to R13 for the decimal places in
_DIGIT and display them.
_DIGIT is a variable in data block GUD6 for setting the decimal places in the measuring
cycles. The value in the default setting is _DIGIT=3.
$PI circle constants PI = 3.1415927. The results in STRING format are supplied in _TXT[0]
to _TXT[2]; the value for the last parameter (R13) also in TEXTVAR.
DEF STRING[12] TEXTVAR
R11=0.1/$PI R12=1/$PI R13=10/$PI
CYCLE118(0,_DIGIT,TEXTVAR,3,11)
MSG("_TXT[0]="<<_TXT[0]<<" _TXT[1]="_TXT[1]<<" _TXT[2]="<<TXT[2])
M0
M30
7-4
passed to the cycle in PAR4.
(PAR2).
data block GUD6).
Data type
REAL
INTEGER
STRING[12]
INTEGER
INTEGER
Value
Meaning
Number to be formatted
≥0
Number of decimal places
Formatted return as STRING
≥1
Number of numbers to be formatted
≥0
Number of the first R parameter only relevant if PAR4>1
;Stop – view values:
;"_TXT[0]=0.032 _TXT[1]=0.318 _TXT[2]=3.183"
Programming Manual, Release 04/2006, 6FC5398-4BP10-0BA0
;$PI - circle constant
;PI = 3,1415927
;Stop – view values:
;"TEXTVAR=31.83"
Measuring cycles

Advertisement

Table of Contents
loading

Table of Contents