PLC Excercises Using Ladder Diagram
PLC Excercises Using Ladder Diagram
O O
F
F N X0
Start/Stop
Proximity switch
X1
Motor
Control Purpose:
When the production line runs, the production control engineer needs to monitor its
real-time speed. The target speed is 1.8 m/s.
The motor and the multi-tooth cam rotate with the same axis. There are 10 teeth on the cam,
so the proximity switch will receive 10 pulse signals when the motor rotate once and the
production line will move forward for 0.325m. The equations are as follows:
The speed of the production line = the rotation times of motor in 1s × 0.325 = (Motor rotation
speed/60) × 0.325.
Indicator status: Production line speed < 0.8 m/s, the Speed Low indicator will be ON. 0.8
m/s production line speed 1.8m/s, the Normal indicator will be on. Production line speed
>1.8m/s, the Speed High indicator will be on.
Display the production line speed for production control engineers to monitor.
Devices:
Device Function
Control Program:
Program Description:
Calculate the motor rotation speed (r/min) by using SPD instruction to detect the pulse
frequency (D0) from the proximity switch. Motor rotation speed = the receiving pulses in
1min/10 = (pulse frequency × 60)/10 = (D0×60)/10.
The following equation is for obtaining the production line speed through D0:
V: Production line speed
N D 0 60 10 D0 (unit: m/s)
v= 0.325 = 0.325 m/s= 0.325 m/s
60 60 10 N: Motor speed (unit: r/min)
D0: Pulse frequency
50
If the detected pulse frequency D0 = K50, the production line speed = 0.325 m/s
10
=1.625m/s by the above equation
The parameter of present production line speed contains decimal points during calculation,
therefore the binary floating point operation instruction is needed for performing the
calculation. .
DEZCP instruction is used to compare the present speed with the upper/lower speed limits
and the comparison results will be stored in M0~M2.
There are integers and floating points mixed in the operation. If the operational parameters
are not binary floating point values before calculating the production line speed, they have
to be converted by FLT instruction
For monitoring easily, the speed value is multiplied with 1000 to obtain the integer in the end
of this program
Control Purpose:
Devices:
Device Function
X0 Initialization switch
X1 Operation control switch
Control Program:
Program Description:
When X0 = ON, sent the values of decimal integers to D0~D7 to form 4 decimal floating
points.
When X1 = ON, elementary arithmetic operations for binary floating points will be executed.
The binary operational results are not intuitively understandable. Therefore, the binary
floating point value would generally be converted into decimal floating point value. In this
program, the binary values in (D105, D104) are converted into decimal values in (D107,
D106) D106 = K6250, D107 = K-4, so the decimal floating point value 6250×10-4 = 0.625.
MEMO
Control Purpose:
There are 4 moments the office bell will ring: on-duty / off-duty time in the morning and
on-duty / off-duty time in the afternoon. When the time is reached, the bell will ring
immediately and last for 1 minute. Users can set the 4 moments and adjust the current time
at any time.
Devices:
Device Function
Control Program:
Program Description:
To avoid the execution error of TWR instruction, the program uses [FMOV K1 D200 K4]
instruction at the beginning. This program operates only the data of Hour/Minute/Second in
D204~D206 but not the data of Year/Day/Month/Date in D200~D203. For TWR instruction,
the setting range: 00~99 for Year, 1~7 for Day(Mon ~Sun), 1~12 for Month and 1~31 for
Date. If the values in D200~D203 are out of the above range, the program will regard it as
an operation error and the instruction will not be executed and the Hour/Minute/Second data
can’t be written either. Therefore, the program sets the Year/Week/Month/Day to K1 to fit the
above range and makes sure TWR instruction can be executed for writing in
Hour/Minute/Second data.
D4, D5 and D6 store the Hour/Minute/Second of the current time read form RTC.
Open Close
X6 X0 X1
Open Close
X4
X2 X3
Y0/Y1
X7
Control Purpose:
The opening hours of the warehouse are from 7:30~22:30, so the door should open at 7:30
and close at 22:30 automatically.
There are 2 sets of control buttons(Open/Close) in the control room for opening or closing
the door manually for special situations.
Devices:
Device Function
Control Program:
Program Description:
The program performs control of warehouse automatic door by a RTC Time Zone Compare
instruction (TZCP). Through the Time Read instruction (TRD), the current time in RTC can
be read in D0~D6. D4, D5 and D6 store the Hour/Min/Sec data.
When Y0 = ON, the motor of door 1will run forward to execute opening action until upper
sensor is activated (X4 = ON).
When Y1 = ON, the motor of door 1 will run reverse to execute closing action until the lower
sensor in activated (X5 = ON).
The opening and closing actions of door 2 are the same with that of door 1.
For some special situations, the opening and closing actions of door 1 and door 2 can also
be performed by pressing manual open buttons (X0/X2) and manual close buttons (X1/X3)
in the control room.
Control Purpose:
Controlling the automatic motor switching between main motor and auxiliary motor.
In some special applications, we use several motors running by turns to protect each motor and
extend their service life. In this program, there are 2 motors running by turns in the cycle: 2 days
(48 hours) for the main motor, then 1 day (24 hours) for the auxiliary motor.
Devices:
Device Function
Control Program:
Program Description:
When X0 = OFF, Y0 and Y1 = OFF, both main / auxiliary motor will not run.
When X0 = ON, the running status of Y0 (main motor) and Y1 (aux. motor) will be decided
by the ON/OFF status of M0 so as to control the two motors running in turns.
For main motor, D0 and D1 record the current time measured in hour and the current time
that is less than an hour (0~3599s). For auxiliary motor, D2 and D3 record the current time
measured in hour and the current time that is less than an hour (0~3599s).
16-bit instruction supports the set time up to 32,767 hours and 32-bit instruction supports
the set time up to 2,147,483,647 hours.
The timer will go on timing after the set time is reached. For restart timing, users need to
clear the current time stored in D0~D3 and reset flag M10 and M11.
Y0 Y1
Move Left Move right
X0(Clean)
Control Purpose:
Controlling the auto cleaner to move left / move right when Clean is pressed.
When the auto cleaner touches the limit switches of left side or right side, the cleaner will
stop. Next time when Clean is pressed again, the cleaner will move to the opposite direction.
Devices:
Device Function
Control Program:
Program Description:
When Clean is pressed, X0 will be activated one time to execute ALT instruction. M0 will be
ON, the cleaner will move left until it touches the left side limit switch. X1 = ON, and Y0 will
be OFF. The cleaner will stop working.
When Clean is pressed again, X0 will be activated again to switch the ON status of M0 to be
OFF. Therefore, Y1 will be ON and the cleaner will move right until it touches the right side
limit switch. X2 = ON, and Y1 will be OFF. The cleaner will stop at the current position.
Wherever the location of the cleaner is, the cleaner will move to the opposite direction every
time when Clean is pressed.
Vertical direction
Horizontal direction
Control Purpose:
Performing traffic lights sequence control at the intersection. In both vertical and horizontal
directions, the traffic lights are set as the following sequence: Red lights ON for 60s , Yellow
lights ON for 3s and green lights ON for 52s and green lights flashing for 5s.
60s
Red
3s
Yellow
Green
52s 5s
Red 60s
3s
Yellow
Green
52s 5s
Devices:
Device Function
Control Program:
Program Description:
In order to simplify the program, INCD (Incremental Drum Sequencer) instruction is used
here to control the traffic lights.
Before the execution of INCD instruction, use MOV instruction to write all the set values into
D500 ~ D505 in advance.
Control Purpose:
Adding material A in the intervals of 10s~20s, 30s~40s and 50~55s, material B in the interval
of 0~10s, 20s~25s and 40s~50s, and material C in the interval of 20s~25s, 30s~35s and
40s~45s.
Devices:
Device Function
Control Program:
Program Description:
Before the execution of ABSD instruction, use MOV instruction to write all the set values into
D500 ~ D517 in advance.