Program Branch (Case - Siemens SINUMERIK 828D Programming Manual

Hide thumbs Also See for SINUMERIK 828D:
Table of Contents

Advertisement

Example 4: Jump with jump condition
Program code
N40 R1=30 R2=60 R3=10 R4=11 R5=50 R6=20
N41 LA1: G0 X=R2*COS(R1)+R5 Y=R2*SIN(R1)+R6
N42 R1=R1+R3 R4=R4-1
N43 IF R4>0 GOTOB LA1
N44 M30
1.10.3
Program branch (CASE ... OF ... DEFAULT ...)
Function
The CASE function provides the possibility of checking the actual value (type: INT) of a
variable or an arithmetic function and, depending on the result, to jump to different positions
in the program.
Syntax
CASE(<expression>) OF <constant_1> GOTOF <jump destination_1>
<constant_2> GOTOF <jump destination_2> ... DEFAULT GOTOF <jump
destination_n>
Significance
CASE
<expression>
:
OF
<constant_1>
<constant_2>
DEFAULT
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
:
Jump statement
:
Variable or arithmetic function
Keyword to formulate conditional program branches.
:
First specify constant value for the variable or arithmetic function
Type:
:
Second specified constant value for the variable or arithmetic
function
Type:
:
For the cases where the variable or arithmetic function does not
assume any of the specified constant values, the DEFAULT
instruction can be used to determine the branch destination.
Note:
If the DEFAULT instruction is not programmed, then in these
cases, the block following the CASE instruction is the jump
destination.
Comments
; Assignment of the initial values.
; Jump marker LA1 set.
; If the jump condition is
fulfilled, then a jump in the
direction of the beginning of the
program to jump marker LA1.
; End of program
INT
INT
Flexible NC programming
1.10 Program jumps and branches
89

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents