Siemens SINUMERIK 840D sl Programming Manual page 461

Nc programming
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

%<m>.<n>P:
%S:
%<m>S:
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0
Conversion of a REAL value corresponding to the setting in machine data
MD10751 $MN_SPRINT_FORMAT_P_DECIMAL into a string with:
● An integer of <m> + <n> places or
● A decimal number with a maximum of <m> pre-decimal places and precisely <n>
decimal places.
Just the same as for the format description %.<n>P, the complete string is saved in
the character code defined by MD10750 $MN_SPRINT_FORMAT_P_CODE.
Conversion for MD10751 = 0:
The REAL value is converted into a string with an integer number of <m> + <n>
places. If required, decimal places are rounded-off to <n> places or filled with 0. The
missing pre-decimal places are filled with spaces. The minus sign is attached, left-
justified; a space is entered instead of the plus sign.
Example:
N10 DEF REAL REAL_VAR=-123.45
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("PUNCHED TAPE FORMAT:%5.3P",REAL_VAR)
Result: The character string "PUNCHED TAPE FORMAT:-xx123450" is written to the
string variable RESULT ("x" in the example represents spaces).
Conversion for MD10751 = 1:
The REAL value is converted into a string with a decimal number with a maximum of
<m> pre-decimal places and precisely <n> decimal places. Where necessary, the
pre-decimal places are cut-off and the decimal places are rounded-off or filled with 0.
If <n> is equal to 0, then the decimal point is also omitted.
Example:
N10 DEF REAL REAL_VAR1=-123.45
N20 DEF REAL REAL_VAR2=123.45
N30 DEF STRING[80] RESULT
N40 RESULT=SPRINT("PUNCHED TAPE FORMAT:%5.3P VAR2:%2.0P",
REAL_VAR1,REAL_VAR2)
Result: The character string "PUNCHED TAPE FORMAT:-123.450 VAR2:23" is writ‐
ten to the string variable RESULT.
Inserting a string.
Example:
N10 DEF STRING[16] STRING_VAR="ABCDEFG"
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF STRING_VAR:%S",STRING_VAR)
Result: The character string "CONTENT OF STRING_VAR:ABCDEFG" is written to
the string variable RESULT.
Inserting a string with a minimum of <m> characters. The missing places are filled
with spaces.
Example:
N10 DEF STRING[16] STRING_VAR="ABCDEFG"
N20 DEF STRING[80] RESULT
N30 RESULT=SPRINT("CONTENT OF STRING_VAR:%10S",STRING_VAR)
Result: The character string "CONTENT OF STRING_VAR:xxxABCDEFG" is written
to the string variable RESULT ("x" in the example represents spaces).
Work preparation
3.1 Flexible NC programming
461

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de sl

Table of Contents