Professional Documents
Culture Documents
George W. Woodruff School of Mechanical Engineering, Georgia Tech
George W. Woodruff School of Mechanical Engineering, Georgia Tech
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
Before the invention of the Programmable Logic Controller
(PLC), most industrial control was done using relay control
panels.
Switches and relays can be arranged in circuits to make
logical decisions. Output from these circuits can be used to
drive “loads” such as motors, heaters, or electromagnetic
coils. A relay control panel is comprised of a single to
thousands of these circuits.
In this Section, relay control panels will be presented.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
2 2
1 1
3 3
Pins 1 and 2 are “normally closed” since they are connected when the
switch is off. T Pins 1 and 2 are not connected when the switch is on.
Pins 1 and 3 are “normally open” since they are not connected when the
switch is off. Pins 1 and 3 are connected when the switch is on.
(Note: Although this is a toggle switch, this switch can symbolize any type
of input source such as push button switches, sensors, power supplies,
etc. in this lecture.)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
3 2
3 2
Off: Coil off, contacts ON: Coil on, contacts
1 and 2 connected 1 and 3 connected
A relay is a combination of coil and switch.
With coil off, the switch goes to its normal position off.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ Switch 1 Coil
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ Switch 1 Coil
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Relay Logic : OR
Using two switches, a logical “OR” operation can
be constructed. An example is given below:
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Relay Logic : OR
Switch 1 off “OR” Switch 2 off = Coil off
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Relay Logic : OR
Switch 1 on “OR” Switch 2 off = Coil on
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Relay Logic : OR
Switch 1 off “OR” Switch 2 on = Coil on
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Relay Logic : OR
Switch 1 on “OR” Switch 2 on = Coil on
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
Basic PLC Components needed to replace relay control
panels will be presented. These include:
Isolated Power Supply Digital Input and Output pins ( DI/0)
Micro-controller Memory
(Note: Advanced features such as Timers, Interrupts, Counters, etc.
will not be discussed in this lecture)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example:
The S7 314C-2 PtP PLC has 16 digital
outputs and 24 digital inputs. Can be
expanded up to 1024 DI/Os by adding
additional DI/O modules.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
Initially PLCs were used to directly replace relay control
panels. To directly replace relay control panels based on
mechanical relays with PLCs based on a micro-controller
presented challenges. These challenges and solutions will
be discussed.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
.
.
.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
.
.
.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
.
.
.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Difference 2:
Relay Control Panel – Since this is made from analogue components. It is possible to replace
a logic section without stopping execution of other logic sections if wired correctly.
PLC – This is made with a digital micro-controller. The micro-controller must be halted to
replace a logic section. All other logic sections will stop operation.
Difference 3:
Relay Control Panel – Since parallel execution of logic sections, all outputs are a function of
one set of inputs.
PLC – Since serial execution of logic sections, all outputs may not be a function of one set of
inputs. (example: input I2 may change as the micro-controller is processing Logic section
George
2. Therefore
George W.Woodruff
Woodruff
1 and
QW. School
Q2 are based
School of
onof Mechanical
different Engineering,Georgia
inputs)
Mechanical Engineering, GeorgiaTech
Tech
ME6405
User Program
To Minimize Difference 2:
If a part of the user program is replaced, the new part is written first to LOAD memory. During
step 5, PLC System Processes, the new part is copied into WORK memory from LOAD
Memory. During the next scan cycle, the new part of the user program will be executed.
To Minimize Difference 3:
If the programmer uses the inputs stored in the Process Input Image, the user program will
have access to the same inputs per scan cycle. Also if the programmer, writes outputs to
the Process Output Image, all the outputs will be updated simultaneously during step 4,
Update Process Output Image.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
The biggest transition from relay control panels to PLCs
was the transition from the hard wired relay logic to logic
defined by user program. In order to allow established relay
logic users to program the PLC, a visual programming
language that looks like a relay control panel was created.
This visual programming language is called “Ladder Logic”.
In this section, basic Ladder Logic will be presented.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
M Marker Memory
Byte Address:
Each Memory Area is addressed in one byte increments
starting at byte 0.
Bit Number:
MSBit is 7 and LSBit is 0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Marker Area
Byte 0 MB0
M1.3
(Note: only bit 3 of Byte 1
Marker Area byte 1) MW1
Byte 2
Byte 3
Byte 4
MD3
Byte 5
Byte 6 MD4
Byte 7
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Peripheral Input
Area
Byte 0
Byte 1 PIB1
PI2.5
(Note: only bit 5 of Byte 2
Peripherial Input Area byte 2)
Byte 3
Byte 4
Byte 5
PID4
Byte 6
Byte 7
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Ground Rail
Virtual Relay Components
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Any D I/O memory bit ( Peripheral or Process Image) is a virtual relay for a
digital input or output pin of the PLC.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
Coil Mechanical Engineering,
( equivalent
Engineering, GeorgiaTech
Georgia Tech
to coil of Mechanical Relay.
Not available for virtual digital input relays)
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ Switch 1 Coil
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Inside PLC
V+ Switch 1
2
V+ V+
Coil
1 1 1
3
(Note: Wired to PLC
Input Pin Associated
3 2 3 2
with Virtual Input
Relay I0.0) (Note: Wired to PLC
Output Pin Associated
Virtual Input Virtual Output with Virtual Output
Relay Q0.0)
Relay at I0.0 Relay at Q0.0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
I0.0 Q0.0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
3
(Note: Wired to PLC V+
Input Pin Associated Coil
3 2
with Virtual Input 1
Relay I0.0) Virtual Input
Relay at I0.0
V+ Switch 2 3 2
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Ladder Logic : OR
V+ Switch 1
2 Coil
1
Switch 2
2
1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
3
(Note: Wired to PLC V+
Input Pin Associated Coil
3 2
with Virtual Input 1
Relay I0.0) Virtual Input
Relay at I0.0
V+ Switch 2 3 2
V+
2 (Note: Wired to PLC
Output Pin Associated
1 1
Virtual Output with Virtual Output
Relay at Q0.0 Relay Q0.0)
(Note: Wired to PLC
Input Pin Associated
3 2
with Virtual Input
Relay I0.1) George Virtual Input
W.Woodruff
George W. Woodruff
Relay SchoolofofMechanical
at I0.1School MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
I0.0 Q0.0
I0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
V+ V+
V+ Switch 1
1 1
2
1 Coil
3
3 2 3 2
Switch 2
1 1
2
1
3
3 2 3 2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
3 Virtual Output
(Note: Wired to PLC Relay at Q0.0 Coil
Input Pin Associated V+
3 2 3 2
with Virtual Input
1
Relay I0.0)
V+ Switch 2
2
1 1 3 2
1 (Note: Wired to
PLC Output Pin
Associated with
(Note: Wired to PLC Virtual Output
Input Pin Associated Relay PQ0.0)
3 2 3 2
with Virtual Input
Relay I0.1)
GeorgeW. Virtual InputSchool of Virtual
W.Woodruff
Woodruff Input Engineering, Georgia Tech
Mechanical
George School
Relay at I0.1 of Mechanical
Relay at I0.1 Engineering, Georgia Tech
ME6405
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
I0.0 I0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
A micro-controller can be used for more than relay logic
with virtual relays. Ladder logic has components that take
advantage of the micro-controller. These components can
be categorized as follows: bit logic,comparator, converter,
counter, data base calls, jumps, integer functions, floating
point functions, move, program control, shift/rotate, status
bits, timers, and word logic.
It is impossible to cover all of the components in one
lecture. This lecture will first explain formatting of
constants. Then, only a few categories and examples of
components will be shown.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Constants
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Constants
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Constants
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Constants
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Bit Logic
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Description:
Set Coil is executed only if power flows to the coil. When executed, the specified
<address> of the element is set to "1". It will remain set even if power is removed
from the coil.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Description:
Reset Coil is executed only if power flows to the coil. When executed, the
specified <address> of the element is reset to "0". No power flow to the coil has
no effect and the state of the element's specified address remains unchanged.
(Note: can be used to reset timers and counters)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example:
Switch 1 connected to Input 0.0
Switch 2 connected to Input 0.1
Coil connected to Output 0.0
I0.0 Q0.0
I0.1 Q0.0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Comparator
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example:
Coil connected to Output 0.0
Q0.0
CMP
== I
MW0 IN1
MW2 IN2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Jumps
Label
Unconditional Jump
Conditional Jump
Not conditional Jump
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
I0.0 “END”
JMP
Components
Components
END
I0.1 Q0.0
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Integer Math
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Description:
IN1 and IN2 are added and the result is stored in OUT when power is
applied to EN . Power flows out of EN0 when power is applied to EN unless
GeorgeW.
George W.Woodruff
WoodruffSchool
School of Mechanical Engineering, Georgia Tech
the addition results in overflow. of Mechanical Engineering, Georgia Tech
ME6405
ADD_I
EN EN0
5 IN1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Move
Move
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Move example:
Description:
IN is moved to Out and power flows out of EN0 when power is applied to
EN.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Move example:
Example:
Move 5 to MW2.
MOVE
EN EN0
5 IN1 OUT MW2
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Timer
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Description:
A power transition from OFF to ON on S will restart the timer. Power flows
from Q while timer is running. The timer will run for a preset time TV.
(Note: 256 timers
George W. allowed
Woodruff inSchool
S7 314C-PtP
of PLC)Engineering, Georgia Tech
Mechanical
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
Timer example:
Example:
Switch 1 connected to Input 0.0
Coil is connected to Output 0.0
T0
I0.0 Q0.0
S_EXt
S Q
S5T#10s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Word Logic
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Description:
IN1 “AND” IN2 is stored in OUT when power is applied to EN . Power flows
out of EN0 when power is applied to EN unless the addition results in
overflow.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
WAND W
EN EN0
MW0 IN1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Section Objectives:
In this section two example ladder logic programs will be
given.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 :
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 (Continued)
Time: Scan cycle right before t = 0s
User Action : None
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 : Continued
Time:Scan cycle at t = 0
User Action: User turns Switch 1 on
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: 2 s)
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 : Continued
Time: Scan cycle right before t = 2s
User Action: None
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: ~0)
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
(Note: There is an inconsistency in this
ME6405 picture. The power is still flowing though the
normally closed contact for M0.0 on the first
Example 1 : Continued rung even though the coil on the second rung
for M0.0 is on. This is due to the serial nature
Time: Scan cycle at t = 2 s of the PLC micro-controller. Since the first
User Action: None rung is evaluated first, the coil was still off
when the micro-controller evaluated the
normally closed contact for M0.0)
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI (Note:
Time left 0 s)
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: 2 s)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405 (Note: Inconsistency from the previous slide
resolved)
Example 1 : Continued
Time: Scan cycle right after t = 2 s
User Action: None
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: 2 s – 1
scan cycle time)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 : Continued
Time: Scan cycle right before t = 4 s
User Action: None
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: ~0 s)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 : Continued
Time: Scan cycle at t = 4 s
User Action: None
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: 0 s)
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
(Note: A once scan cycle error has been
ME6405
introduced in the timing. The reason is that
the coil of M0.0 on the second rung was
Example 1 : Continued turned off during the scan cycle at t = 4s. The
normally closed switch of M0.0 is not
Time: Scan cycle right after t = 4 s evaluated again until the scan cycle after the
User Action: None scan cycle at t = 4 s. Therefore, Timer T0
starts one scan cycle after t = 4. This error will
propagate and similar errors will accumulate. )
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI (Note:
R BCD Time left: 2 s)
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 : Continued
Time: Some time later
User Action: User turns Switch 1 off
T0
I0.0 M0.0 Q0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
T1
I0.0 Q0.0 M0.0
S_EXt
S Q
S5T#2s TV BI
R BCD
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 1 :
Comments:
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 2 :
If Switch 1 is turned on, the conveyer belt will transport 1000 magnetic
SHAFTS to Georgia Tech Students. Switch 1 must be turned off then on to
send another 1000 magnetic SHAFTS. The hall affect switch is positioned
right under the conveyer belt and can be used to count the SHAFTS as
they pass by.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
Example 2 (Continued)
Time: Scan cycle right before t = 0s
Actions : no part near hall effect switch
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: There is an inconsistency. Power is still
ME6405 flowing though normally closed contact for
Example 2 (Continued) M0.0 even though the coil M0.0 is on. Since
the components on a rung is evaluated from
Time: Scan cycle at t = 0s left to right, coil for M0.0 when micro-controller
Actions : Switch 1 is turned on, evaluated the normally closed contact for M0.0
no SHAFT near hall effect switch was still off. Same for PQ0.0)
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency from previous slide
ME6405 resolved. The conveyer is still moving because
of the “Set” coil.)
Example 2 (Continued)
Time: Scan cycle right after t = 0s
Actions : no SHAFT near hall effect switch
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Similar Inconsistency between normally
ME6405 closed switch of M0.1 and coil of M0.1 as seen
with normally closed switch of M0.0 and coil of
Example 2 (Continued) M0.0)
Time: t = t1
Actions : SHAFT approaches hall effect switch, 1 is added to MW1
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency from previous slide
ME6405 resolved.)
Example 2 (Continued)
Time: t = t1 + 1 scan cycle
Actions : SHAFT passes over hall effect switch
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency between the “set” and
ME6405 “reset” of M0.1. That is because coil is still set
when the third rung is evaluated.)
Example 2 (Continued)
Time: t = t1 + 2 scan cycle
Actions : no SHAFT near hall effect switch
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency between the “set” and
ME6405 “reset” of M0.1 resolved.)
Example 2 (Continued)
Time: t = t1 + 3 scan cycle
Actions : no SHAFT near hall effect switch
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
ME6405
Example 2 (Continued)
Time: t = t2
Actions : the 1001th SHAFT approaches hall effect switch (so 1000 have been delivered)
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency between the “set” and
ME6405 “reset” of PQ0.0. That is because coil is still
set when the first rung is evaluated.)
Example 2 (Continued)
Time: t = t2+ 1 scan cycle
Actions : the conveyer is stopped with 1001th SHAFT over the Hall effect switch
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
(Note: Inconsistency from previous slide
ME6405 resolved.)
Example 2 (Continued)
Time: t = t2+ 1 scan cycle
Actions : the conveyer is stopped. Switch 1 must be turned off and on to deliver 1000 more
I0.0 M0.0
R
CMP Q0.0
== I R
1001 IN1
MW1 IN2
I0.1 M0.1 ADD_I M0.1
EN EN0 S
1 IN1
MW1 IN2 OUT MW1
I0.1 M0.1
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
R
ME6405
Example 2 :
Comments:
This and the previous example illustrates that the serial nature of the PLC
micro-controller can still affect program execution.
Also, this program can be simplified using an positive edge detection coil.
This was not done because the positive edge detection coil was not an
example in Section 5.
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech
ME6405
So far we have looked at topics applicable to all PLC’s. Further Study Should focus
on:
Communication Protocol:
Profibus
How to use communications to communicate with other PLC’s,
smart actuators and sensors, etc…
GeorgeW.
George W.Woodruff
WoodruffSchool
SchoolofofMechanical
MechanicalEngineering,
Engineering,Georgia
GeorgiaTech
Tech