
606
Program Example
Section 10-1
10-1-29 Selective Execution (SWITCH, CASE, BREAK, SEND)
Explanation of the
operation
• 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.
Note
❍
indicates that the axis is operated.
Program
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;
Explanation of the
program
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.
Combination
General input 1
(0B01)
General input 2
(0B02)
[J01]
[J02]
[J03]
1
2
1
❍
×
×
2
1
2
×
❍
×
3
2
2
❍
❍
×
4
1
1
×
×
❍
Summary of Contents for CS1W-MCH71 -
Page 2: ...CS1W MCH71 CJ1W MCH71 Motion Control Unit Operation Manual Revised June 2008 ...
Page 3: ...iv ...
Page 29: ...xxx ...
Page 33: ...xxxiv ...
Page 35: ...xxxvi ...
Page 39: ...xl ...
Page 69: ...24 Performance Section 1 7 ...
Page 99: ...54 Connecting MECHATROLINK Devices Section 3 5 ...
Page 283: ...238 Saving Data Section 5 4 ...
Page 417: ...372 Command Details Section 6 3 ...