Siemens Sinumerik 840D sl Programming Manual page 89

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

Advertisement

%.<n>P:
Job planning
Programming Manual, 02/2011, 6FC5398-2BP40-1BA0
Converting a REAL value into an INTEGER value taking into account <n> decimal
places. The INTEGER value is output as a 32-bit binary number. If the value to be
converted cannot be represented with 32 bits, then processing is interrupted with
an alarm.
As a byte sequence generated using the format instruction %.<n>P can also
contain binary zeroes, then the total string that is generated in this way no longer
corresponds to the conventions of the NC data type STRING. As a consequence, it
can neither be saved in a variable, type STRING, nor be further processed using
the string commands of the NC language. The only possible use is to transfer the
parameter to the WRITE command with output at an appropriate external device
(see the following example).
As soon as the <Format_String> contains a format description, type %P then the
complete string, with the exception of the binary number generated with %.<n>P, is
output corresponding to the MD10750 $MN_SPRINT_FORMAT_P_CODE in the
ASCII character code, ISO (DIN6024) or EIA (RS244). If a character that cannot be
converted is programmed, then processing is interrupted with an alarm.
Example:
N10 DEF REAL REAL_VAR=123.45
N20 DEF INT ERROR
N30 DEF STRING[20] EXT_DEVICE="/ext/dev/1"
...
N100 EXTOPEN(ERROR,EXT_DEVICE)
N110 IF ERROR <> 0
...
N200 WRITE(ERROR,EXT_DEVICE,SPRINT("INTEGER BINARY
CODED:%.3P",REAL_VAR)
N210 IF ERROR <> 0
... ; error handling
Result: The string "INTEGER BINARY CODED: 'H0001E23A'" is transferred to the
output device /ext/dev/1. The hexadecimal value 0x0001E23A corresponds to the
decimal value 123450.
Flexible NC programming
1.9 String operations
; error handling
89

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de slSinumerik 828d

Table of Contents