Omron SYSMAC CS1G Operation Manual page 582

Motion control unit
Table of Contents

Advertisement

Program Example
10-1-29 Selective Execution (SWITCH, CASE, BREAK, SEND)
Explanation of the
operation
Program
Explanation of the
program
• The processing is selectively executed according to the values of condi-
tional variables.
• In this example, different operations are executed depending on the val-
ues of the general input at program startup.
Combination
General input 1
1
2
2
1
3
2
4
1
Note ❍ indicates that the axis is operated.
01) PROG P033 Q00000007;
02) WHILE #IW0B00 == 0;
03) #ML0000 = 0;
04) #MB00000 = SET #IB0B011 & #IB0B020;
05) #MB00001 = SET #IB0B010 & #IB0B021;
06) #MB00002 = SET #IB0B011 & #IB0B021;
07) WEND;
08) SWITCH #ML0000;
09) CASE 1;
10) MOVE [J01]50000; Processing 1
11) BREAK;
12) CASE 2;
13) MOVE [J02]50000; Processing 2
14) BREAK;
15) CASE 4;
16) MOVE [J01]50000 [J02]50000; Processing 3
17) BREAK;
18) DEFAULT;
19) MOVE [J03]50000; Processing 4
20) SEND;
21) MOVE [J01]0 [J02]0 [J03]0;
22) END;
01) A program No. and axes to be used are specified.
02) With WHILE command, the process through 02) to 07) will be repeated
until the general input (IW0B00) becomes a value other than 0.
03) The conditional variable (ML0000) is reset to 0.
04) to 06) Depending on the values of the general inputs (IW0B01, IW0B02),
the bit of the conditional variable (ML0000) is turned ON.
07) This is the end of WHILE command from 02).
08) to 20) With SWITCH command, when the conditional variable (ML0000)
is 1, 2, or 4, processing 1, 2, or 3 will be executed respectively. Pro-
cessing 4 will be executed when the conditional variable is not 1, 2,
or 4.
09) to 11)Content of processing 1
12) to 14)Content of processing 2
15) to 17)Content of processing 3
18) to 19)Content of processing 4
20)This is the end of SWITCH command.
General input 2
(0B01)
(0B02)
1
2
2
1
Section 10-1
[J01]
[J02]
[J03]
×
×
×
×
×
×
×
559

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cs1w-mch71Sysmac cs seriesSysmac cs1h

Table of Contents