Application Examples of Basic Commands: Operation
Application Examples of Basic Commands: Operation
Application Examples of Basic Commands: Operation
S3 Motor2
010.01
Motor2
Network 2 – Motor1
000.01 TIM001 010.00
S2 Motor1
010.00
Motor1
Network 3 – Delay for 2sec
010.00 000.01
TIM
Motor1 S2 000
#0020
Network 4 – Sensor1
000.00 TIM001 200.00
S1
200.00
Network 6 – Motor3
253.13 010.02
NC Motor3
Network 7 – End
End (01)
Operation :
a) Motor 2 turns ON when Sensor 3 detects the product
b) Motor 2 is ON until Motor 1 is turned ON and product is out of detection range of Sensor 2
c) Motor 1 turns ON when Sensor 2 detects the product
d) Motor 1 is ON until product is out of detection range of Sensor 1
Move – MOV(21)
6-60
6. APPLICATION EXAMPLES OF BASIC COMMANDS
MOV transfer source data (either the data in a specified channel or a four digit hexadecimal
constant) to a destination channel. Therefore, MOV requires two data parameters to be specified: the
source channel or constant and the destination channel.
S D: Destination channel
D
IR, AR, DM, HR, LR
Example circuit
Ladder diagram
25313
MOV(21)
000 Source
SOURCE DESTINATION
INPUT 200 OUTPUT
Destination
CH 000 CH 200
00000 1 20000 1
00001 1 20001 1
Address
00002 Instruction
0 Data 20002 0
0000 LD 25313
00003 1 20003 1
0001 MOV(21)
00004 1 000 20004 1
00005 0 200 20005 0
0003 END(01)
00006 0 20006 0
Channel 000 Channel 200
bit 00 00007 1 20007 1 bit 00
to 00008 1 20008 1 to
bit 15 bit 15
00009 1 20009 1
00010 1 20010 1
00011 0 20011 0
00012 0 20012 0
The
00013 following
0 diagram illustrates the MOV operation:
20013 0
00014 0 20014 0
00015 1 20015 1
6-61
Status Status
6. APPLICATION EXAMPLES OF BASIC COMMANDS
In this case, data in Input Channel 000 is moved to Output Channel 200.
6-62
6. APPLICATION EXAMPLES OF BASIC COMMANDS
1. Activation of error input signal 00001 to 00004 will sound an alarm and at the same time
display the error code.
2. Input 00005 serves to reset the error code displayed upon machine recovery.
Error code
CODE 004
Fault location
Diagram
I/O Assignment
Input Devices Output Devices
Emergency 6-63
Stop button
6. APPLICATION EXAMPLES OF BASIC COMMANDS
00001 PB1 1000 Alarm
00002 PB2 Annunicator
00003 PB3
00004 PB4
CODE 002
fault location
Sensor S01
PB1 Alarm
000.02
PB2
000.03
6-64
PB3
6. APPLICATION EXAMPLES OF BASIC COMMANDS
000.04
PB4
Network 2 – Code 1
Feeding Problem
000.01
MOV(21)
PB1 #0001
010
Network 3 – Code 2
No Label
000.02
MOV(21)
PB2 #0002
010
Network 4 – Code 3
Conveyor Jam
000.03
MOV(21)
PB3 #0003
010
Network 5 – Code 4
Emergency Stop
000.04
MOV(21)
PB4 #0004
010
Network 6 – Code 5
Reset Code Display
000.05
MOV(21)
Resetsw #0000
010
Network 7 – End
End (01)
Compare – CMP(20)
Compare (CMP) is used to compare the data in a specific channel, with the data in another channel,
or a four-digit, hexadecimal constant. Therefore, two data must be specified immediately after the
CMP(20) instruction.
6-65
6. APPLICATION EXAMPLES OF BASIC COMMANDS
Example circuit
Ladder diagram
25313 TR 0
CMP(20)
#01F0
Address Instruction Data
000 0000 LD 25313
0001 OUT TR 0
0002 CMP(20) -
#01F0
000
25505 (>)
0003 AND 25505
01000 0004 OUT 01000
0005 LD TR 0
25506 (=)
0006 AND 25506
01001 0007 OUT 01001
0008 LD TR 0
25507 (<)
0009 AND 25507
01002 0010 OUT 01002
# 0 1 F 0
6-66
6. APPLICATION EXAMPLES OF BASIC COMMANDS
0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 DATA
Constant
Compare with
Channel
00015 00014 00013 00012 00011 00010 00009 00008 00007 00006 00005 00004 00003 00002 00001 00000 CH 000
0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 DATA
# 0 1 F 0
If the constant (#01F0) is equal to Channel 000 data, special relay 25506 turns ON. However,
special relay 25505 will turn ON if the constant is greater than Channel 000 data and special relay
25507 will turn ON if the constant is less than Channel 000 data. At any one time, only one result is
true, either relay 25505(>) or 25506(=) or 25507(<) is ON.
Display
01000
Start (0)
01001
01003
6-67
6. APPLICATION EXAMPLES OF BASIC COMMANDS
In this application, a 7-segment display & a buzzer is connected to the PLC. When the start button is
pressed, the display will display a 9 and therefore will decrement until 0 before the buzzer is being
sound. These type of circuit can be used as a warning circuit.
I/O Assignment
010.05
HR01.00
Buzzer
000.01
Stop_pb
Network 2 – Move 9
Move 9 to channel 6
HR01.00
@MOV(21)
#0009
006
6-68
6. APPLICATION EXAMPLES OF BASIC COMMANDS
Network 3 – Timer
To produce an ON/OFF pulse
253.13 TIM001
TIM
001
#0012
Network 4 – Decrement
Decrement every execution
HR01.00 TIM001
@DEC(39)
006
Network 5 –
Compare the o/p with 0, if equal (25506 on) output 00500 turn on
253.13 HR01.00
CMP(20)
006
#0000
255.06 005.00
=Fla Workbit
g
Network 6 - Buzzer
005.00 TIM000 000.01 010.05
Buzzer
Network 7 –
Timer to cut the sound of buzzer
005.00 000.01 TIM000 005.01
Network 8 – Stop
Reset channel 10
000.01
MOV(21)
Stop_pb
#0000
TIM000
006
RST
Network 9 – Segment1display
006.00 010.00
o/p.00
6-69
6. APPLICATION EXAMPLES OF BASIC COMMANDS
Network 10 – Segment2display
006.01 010.01
o/p.01
Network 11 – Segment3display
006.02 010.02
o/p.02
Network 12 – Segment4display
006.03 010.03
o/p.03
Network 13 – End
End (01)
Notes : Instruction with @Sign will execute on the rising edge only.
It means that the instruction will execute for one scan only.
6-70