Reading And Writing Of Individual Characters - Siemens SINUMERIK 840D sl Programming Manual

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

Advertisement

Work preparation
3.1 Flexible NC programming
3.1.4.8

Reading and writing of individual characters

Individual characters can be read and written within a string.
The following supplementary conditions must be observed:
● Only possible with user-defined variables, not with system variables
● Individual characters of a string are only transferred "call by value" for subprogram calls
Syntax
<Character>=<string>[<index>]
<Character>=<string_array>[<array_index>,<index>]
<String>[<index>]=<character>
<String_array>[<array_index>,<index>]=<character>
Meaning
<string>:
<character>:
<index>:
Examples
Example 1: Variable message
Program code
;
DEF STRING [50] MESSAGE = "Axis n has reached position"
MESSAGE [6] = "X"
MSG (MESSAGE)
Example 2: Evaluating a system variable
Program code
DEF STRING[50] STRG
...
STRG = $P_MMCA
IF STRG[0] == "E" GOTO ...
Example 3: Parameter transfer "call by value" and "call by reference"
Program code
;
DEF STRING[50] STRG = "Axis X"
DEF CHAR CHR
...
454
Any string
Variable of type CHAR
Position of the character within the string.
First character of the string: Index = 0
Range of values: 0 ... (string length - 1)
Comment
0123456789
; "Axis X has reached position"
Comment
; Buffer for system variable
; Load system variable
; Evaluating the system variable
0123456
Comment
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0
NC programming

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de sl

Table of Contents