Siemens Sinumerik 840D sl Programming Manual page 88

Job planning
Hide thumbs Also See for Sinumerik 840D sl:
Table of Contents

Advertisement

Flexible NC programming
1.9 String operations
%<m>G:
%.<n>G:
%<m>.<n>G:
88
Conversion into a string with a decimal number – depending on the value range – in
a decimal or exponential notation (like %G). The string has a total length of at least
<m> characters. The missing characters are filled with spaces, left-justified.
Example with decimal notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX-04
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF REAL_VAR:%15G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:xxxx0.000123457" is
written to the string variable RESULT ("x" in the example represents spaces).
Example with exponential notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX+06
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF REAL_VAR:%15G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:xxx1.23457EX+06" is
written to the string variable RESULT ("x" in the example represents spaces).
Conversion into a string with a decimal number – depending on the value range – in
a decimal or exponential representation. A maximum of <n> significant places are
displayed or if required, rounded-off. If the absolute value to be represented is less
than 1.0EX-04 or greater than/equal to 1.0EX(+<n>), then the exponential notation
is selected, otherwise the decimal notation.
Example with decimal notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX-04
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF REAL_VAR:%.3G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:0.000123" is written to the
string variable RESULT.
Example with exponential notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX+03
N20 DEF STRING[80] RESULT
N30 RESULT = SPRINT("CONTENT OF REAL_VAR:%.3G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:1.23EX+03" is written to
the string variable RESULT.
Conversion into a string with a decimal number – depending on the value range – in
a decimal or exponential notation (like %.<n>G). The string has a total length of at
least <m> characters. The missing characters are filled with spaces, left-justified.
Example with decimal notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX-04
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF REAL_VAR:%12.4G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:xxx0.0001235" is written
to the string variable RESULT ("x" in the example represents spaces).
Example with exponential notation:
N10 DEF REAL REAL_VAR=1.234567890123456EX+04
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF REAL_VAR:%12.4G",REAL_VAR)
Result: The character string "CONTENT OF REAL_VAR:xx1.235EX+06" is written
to the string variable RESULT ("x" in the example represents spaces).
Programming Manual, 02/2011, 6FC5398-2BP40-1BA0
Job planning

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de slSinumerik 828d

Table of Contents