0% found this document useful (0 votes)
68 views24 pages

4-PLC Programming-2020-Supplimentary Notes1

- Ladder logic is the main programming language for PLCs and uses vertical power rails and horizontal rungs to represent circuit diagrams [1]. - A PLC scans the ladder program from left to right and top to bottom, taking a few milliseconds to complete one scan cycle. Inputs are placed on the left of rungs and outputs on the right [2]. - Common logic functions like AND, OR, and NOT can be implemented using series and parallel connections of inputs and outputs in ladder rungs [3].

Uploaded by

Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views24 pages

4-PLC Programming-2020-Supplimentary Notes1

- Ladder logic is the main programming language for PLCs and uses vertical power rails and horizontal rungs to represent circuit diagrams [1]. - A PLC scans the ladder program from left to right and top to bottom, taking a few milliseconds to complete one scan cycle. Inputs are placed on the left of rungs and outputs on the right [2]. - Common logic functions like AND, OR, and NOT can be implemented using series and parallel connections of inputs and outputs in ladder rungs [3].

Uploaded by

Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

EMC 311/3 Mechatronics

PLC Programming
Supplementary Notes 1

Assoc. Prof. Dr Elmi Abu Bakar


Tel.: 04-5995954
Fax: 04-5996911
Email: [email protected]
http://elearning.usm.my/
Introduction
• Ladder logic is the main programming language for the PLC.
In comparison to other computer programming languages,
ladder programming is simpler.
• Usually, PLC controllers are meant to be used by both
technicians and engineers. As a result, ladder logic language
should be both simple and robust.
• After the adoption of ladder programming, dierent PLC
manufacturers created their own versions of the language.
• Therefore, it was necessary to develop a standard for ladder
logic programming. Later, IEC standardized the PLC
programming languages including ladder programming in
1993. .
Ladder logic diagrams

• Ladder diagrams are essential in PLC programming.


Therefore, let’s consider a simple example.
• The following diagram shows a simple circuit to control a
motor using a switch.

We can represent the same circuit using two vertical power rails
The following diagram shows a simple circuit to
as follows.
control a motor using a switch.
Ladder logic diagrams
• We have the motor and switch connected serially in both of
the above diagrams. Therefore, the motor turns on only
when we close the switch. We call the second circuit
diagram a ladder diagram.
• In ladder logic diagrams, we always have the power lines as
two vertical bars. We call them with many names including
power rails and power lines.
• We also connect all the other circuit elements horizontally
between the two rails. The overall view of the circuit looks
like a ladder.
• Vertical power lines are like vertical ladder sides and
horizontal lines are like ladder rungs. .
Introduction
• Furthermore, we don’t try to represent a circuit completely
in a ladder diagram. We only consider the required control
structure of the circuit.
• Usually, in a circuit diagram, We have to show the relative
positions of each component.
• In a ladder diagram, we don’t represent that relative
positioning and we only show the control methods for each
circuit element..
Common conventions in a ladder diagram
• We represent the power lines as vertical lines in the diagram. Power
flows from the le rail to the right rail across a rung.
• Single rung represents a single control operation. A rung should
start with one or more inputs and should end with one or more
outputs. For example, a switch is an input and a motor is an output.
• We show the circuit elements in their normal state. Therefore, we
show a normally open switch as open in the diagram.
• Likewise, we show a normally closed switch as closed in the ladder
logic diagram. A single circuit element can appear in many rungs.
• In this case, we use the same names for such elements. We specify
inputs and outputs using manufacturer supplied I/O addresses. .
PLC scanning of the ladder logic program.

• A PLC scans the ladder diagram from le to right and top to


bottom. As an example, PLC starts scanning from the topmost
rung and it scans that rung from le to right.
• After that, it proceeds to the second rung and starts to process it
from le to right. This process continues until the final rung in the
program.
• We call that rung the end rung and we denote it using an END
block. After that PLC starts to rescan the program from the
beginning.
• The time required to complete a single scan cycle depends on the
number of rungs.
• Generally, it takes a millisecond range duration(10 ms – 50ms) to
complete a cycle.
PLC scanning of the ladder logic program
• We can show the scanning process of the ladder program as
follows.
Standard symbols in ladder logic diagrams
Ladder diagram for a simple control action

• In order to understand ladder logic programming, let’s


consider a simple control task of switching a motor. In this
case, we have one input and one output.
• First, we have to place the input switch in the left side of the
rung.
• After that, we can place the output motor in the rung. If the
switch is a normally open one, the ladder diagram is as
follows. .
Ladder diagram for a simple control action
Ladder diagram for a simple control action
Input and output specification in ladder logic
• When we write an actual ladder program, we have to use
the manufacturer provided addresses for our inputs and
outputs.
• For example, you might connect a switch to a particular PLC
input and a motor to a particular PLC output.
• In this case, when you draw the ladder diagram, you have to
specify the corresponding addresses of those input and
output pins. We can show such a simple ladder diagram for a
Mitsubishi PLC as follows. .
Input and output specification in ladder logic
Logic functions for ladder programming
• Typically you have situations where the condition for a
control decision depends on more than one input.
• For example, you might have a situation where you want to
turn on a device only when the two control switches are
closed.
• Accordingly, the device should run only when both the
switches are closed.
• This is the typical AND logic function. We can implement
various logic functions in ladder logic as follows..
Logic functions for ladder programming

We should close both the inputs in order to turn on the output.


Generally, a series connection specifies an AND operation.
Logic functions for ladder programming

The output turns on when at least a single input is


activated. Generally, a parallel connection specifies an OR
Logic functions for ladder programming

As you can see, we are using a


normally closed switch. As a
result, when we apply an input, the
switch opens and no current
flows in the circuit.
Furthermore, when you release the
input, switch closes again and the
output gets activated again.
This is the typical NOT gate
operation.
Logic functions for ladder programming
Logic functions for ladder programming
Logic functions for ladder programming
Multiple outputs in a ladder diagram
Latching circuits in the ladder logic
• For all the previously stated circuits, output retains its state
only as long as the input is present. Therefore, if we release
the input, the output goes back to its original state.
• Sometimes we want the output to retain its state even after
the removal of the input. For example, we might want to use
simple push buttons to control a motor.
• In this case, we want one push button to turn on the motor
and another to turn it o. Push buttons are only momentary
inputs. Therefore, we have to use a latching mechanism to
retain the output state. .
Latching circuits in the ladder logic

You might also like