0% found this document useful (0 votes)
18 views

Emtc 135 Module 3

PLC Programming

Uploaded by

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

Emtc 135 Module 3

PLC Programming

Uploaded by

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

1

MODULE III

PLC PROGRAMMING

LESSON IMPORTANT PROGRAMMING


1 METHODS

LESSON ELEMENTS OF PLC


2
2

MODULE III
PLC PROGRAMMING

 INTRODUCTI
In this module you will learn about the different PLC systems. PLC’s
are like computers which also consist of three functional areas:
processing, memory, and input/output. Input signals to the PLC are
read and then stored in the memory, where the processor performs the
programmed logic instructions on these input signals. Output signals are
then generated to drive output devices. The action taken depends totally
on the program which is stored in the memory. In addition, a
programming unit is used to download the program to the PLC memory.

Learn to make programs for PLC. The user or the system designer is
usually the one who develops the control program. The control program is
made up of things called instructions. Instructions are little computer
codes that make the inputs and outputs do what you want to get the
result you need.

OBJECTIV
ES
After reading the module, you should be able to:
1. Identify the different programming methods used in the PLC
software
2. Translate and apply PLC instruction in a circuit.
3. Create a simple to complex plc program
4. Simulate and run the program
5. To conceptualized control processing, memory and input /output
signals
6. To figure out power supply, input field devices, output field
devices, Central Processing Unit, memory and programming
devices on the PLC system.
7. To distinguish different accessories interfaced in the PLC system.

 DIRECTIONS/ MODULE ORGANIZER

There are two lessons in the module. Read and understand the
lessons carefully. Answer the exercises and activities given after each
lesson then submit your output to the concern instructor.
3

You may contact the concern faculty whenever problems arises


regarding the lesson and or discuss the matter with your instructor during
face-to-face meeting.
Lesson 1

 PLC PROGRAMMING

A program consists of one or more instructions that accomplish a


task. Programming a PLC is simply constructing a set of instructions.
There are several ways to look at a program such as: These presentations
are also known as programming languages.

 ladder logic,
 statement lists, or
 function block diagrams.

Ladder diagram

Ladder logic (LAD) is one programming language used with PLCs.


Ladder logic uses components that resemble elements used in a line
diagram format to describe hard-wired control.

Ladder Logic

One of the best visual programming languages is a PLC


programming language. It’s called ladder logic or ladder diagram
(LD) and you can learn it very fast.

The smart thing about ladder logic is that it looks very similar to
electrical relay circuits. So if you already know a little bit about relay
control and electrical circuits, you can learn ladder logic even faster.

Ladder logic (also known as ladder diagram or LD) is a programming


language used to program a PLC (Programmable Logic Controller). It is a
graphical PLC programming language which expresses logic operations
4

with symbolic notation. Ladder logic is made out of rungs of logic, forming
what looks like a ladder – hence the name ‘Ladder Logic’.

How to Read Ladder Logic

Another difference between ladder logic diagrams and electrical


schematics is the way they are drawn. Where electrical schematics are
often drawn horizontal, ladder logic diagrams are drawn vertically.

The best explanations for drawing ladder logic vertical instead of


horizontal:

1. Easier to read

First of all, it makes ladder logic easier to read because it is natural


for the eye to go from the left to right and then down to the next line. Just
like when you are reading. Of course, this applies only to people living in
countries where the reading is done from left to right.

2. Drawn on computer

When you draw ladder logic on a computer you will make one line at
a time. As you draw more and more lines (in ladder logic called rungs)
they will stack on top of each other, making up what looks like a ladder.
The best way to look at a large ladder diagram with many lines is to scroll
vertically along with the screen.

3. Order of execution

The last reason for drawing ladder logic vertically is to set the order
of execution. The order of execution is how the PLC will run your ladder
logic. To be more precise in what order your ladder logic instructions will
be executed by the PLC. A PLC will always start at the top of your ladder
logic and then execute its way down.

Ladder Logic

As I said before ladder diagrams can look a lot like electrical


schematics going vertical. Most people learn to draw ladder logic
diagrams this way – by building them as electrical schematics. But there
are some differences. This is why I will advise you to learn it in a different
way.

I will explain this way in this ladder logic tutorial.

The problem here is that electrical control systems and the PLC work in
different ways. Here are the biggest differences:
5

 The PLC takes one ladder logic line (rung) and executes that and
then goes to the next line
 In electrical systems, multiple lines (current pathways) can be
executed (activated) at the same time

Ladder Logic Basics

The first thing you will see when you create a new piece of ladder
logic is two vertical lines. It is in between these two lines your ladder logic
goes. When you draw ladder logic, you will draw vertical connections
between these two lines. Each of those is called a rung. Just like on a
physical ladder.

Examine if Closed

The first instruction here is called examine if closed. The symbol


for the instruction looks like this:

Examine if closed is also known as normally open. It works


basically the same way as a normally open contact in an electrical circuit.
Of course, the normally open contact has no memory bit as a condition.
The condition is whether the contact is activated or not. So the condition
could be a finger pressing a button.

The main point here is that each instruction has to be assigned an


address in the PLC.

Yes, inputs and outputs are also bits of memory in the PLC. In the
example above, the examine if closed instruction has been given memory
address I0.0 as a condition. This address belongs to the first input of the
PLC.

Here’s how that works:

 When the PLC scan cycle starts, the PLC will check the states of all
its inputs.
 It will then write in memory the boolean value for these states (0 or
1).
 If an input is LOW the bit will be set to 0.
 And if the input is HIGH the memory bit will be set to 1.
6

Output Coil

The instruction itself even has a place in the PLC memory. What the
PLC will put there is the result of the instruction. To see what the PLC uses
that result for, we have to look at the next instruction:

An output coil is used to turn a bit on and off.

This symbol is placed on the right side of the rung. This means, that
all the instructions that come before (in the same rung) act as a condition
for that instruction.

Output Latch

In the previous example, you learned how to read the state of digital
input and set a digital output to the same state. Let’s say that digital input
is a momentary pushbutton. It is called momentary because it has a
spring inside. This means, that the pushbutton will only be active as long
as you press it.

The ladder program above works just fine. But as you might have
noticed, the output will only be active as long as the input is active. You
will have to hold your finger on the button to keep the output activated.
But let’s say that the output controls a fan for a ventilation system. It
would not be very convenient for the operator to hold down the button all
the time. We need a way to keep the output active, even though the
operator releases the pushbutton.

If you are familiar with electrical schematics, you may find this
familiar. This is called a latch or a self-hold.
7

The name reveals how this works. The coil simply holds itself. Let’s
take it step-by-step to see how that works:

When the PLC runs this ladder logic program the first time (with the
button pressed), the output will be activated. This is just like the example
before. The fun happens the second or third time the PLC runs the ladder
logic. Since this is a momentary pushbutton, it will not be active for long.
Depending on how long time the PLC takes to execute the program, the
button might be deactivated again the second, third or fourth time.

Let’s jump forward to the first scan cycle where the button is no
longer pressed.

The output is still active since the pushbutton was pressed in the
last scan cycle.

The reason that the self-holding instruction is put in parallel to the


other instruction is to make it an OR condition. I will come back to that
later. Important to know here is that either I0.0 OR Q0.0 has to be true to
activate the output.

Examine if Open

Well, congratulations!

You just learned how to make a functioning ladder PLC program. A


pushbutton that activates an output. In our example, this would be
connected to a contactor giving supply to a fan. The output then holds
itself.

But there is a practical problem with this program. How do we stop


the fan?

We want, somehow to be able to turn off the output again. The


simplest way to do that would be to add a stop button. The button will be
connected to the second input. Thereby giving it the memory
address I0.1.

The question is now; which instruction should we use for the stop
button?

And even more important; where should we place it in our ladder


logic?

To answer the first question, let me introduce you to another ladder


logic instruction: examine if open.

Here’s how the examine if open symbol looks like:


8

This instruction works the exact opposite way of the examine if


closed instruction. The result of this instruction will be an inverted
condition. It simply means that, if the condition is “0” the result will be
“1”. Vice versa of course, so with condition “1” the result will be “0”.
If you think about it, this is precisely how we want to stop button to work.
To turn off the output coil we must somehow give it the condition “0”.

Now to the second question. Where to place it?

We have to place it after the self-holding instruction. Said in another


way – serial connected. Otherwise, the latch would still give a “1”
condition to the output coil when stop button is pressed.

Now, we end up with this ladder logic:

You can see that it inverts the condition to the output coil. This will
break the latch. To activate the latch again, the start button has to be
pressed.

In the example above I used the examine if open instruction for a


stop button.

Logic instructions (Statement List)

 A statement list (STL) provides another view of a set of instructions.


The operation, what is to be done, is shown on the left. The
operand, the item to be operated on by the operation, is shown on
the right.
9

 A comparison between the statement list shown below, and the


ladder logic shown on the previous page, reveals a similar structure.
The set of instructions in this statement list perform the same task
as the ladder diagram.

Network 1
LD I0.1
OR Q0.4
ANDN I0.3
ST Q0.4

Function Block Diagram

 Function Block Diagrams (FBD) provide another view of a set of


instructions. Each function has a name to designate its specific task.
Functions are indicated by a rectangle.
 Inputs are shown on the left-hand side of the rectangle and outputs
are shown on the right-hand side. The function block diagram shown
below performs the same function as shown by the ladder diagram
and statement list.

THIN

Design a Ladder Logic for a Start-Stop Control System.


Start button address is I0.0, stop button address is I0.1,
and Coil address is Q0.0
10

Lesson 2

 ELEMENTS OF PLC

A PLC basically consists of two elements:


 the central processing unit
 the input/output system
The central processing unit (CPU) is the part of a programmable
controller that retrieves, decodes, stores, and processes information. It
also executes the control program stored in the PLC’s memory.

In essence, the CPU is the “brain” of a programmable controller.


It functions much the same way the CPU of a regular computer
does, except that it uses special instructions and coding to
perform its functions.
11

The Central Processing Unit (CPU)

 The processor is the section of the CPU that codes, decodes,


and computes data.
 The memory system is the section of the CPU that stores
both the control program and data from the equipment
connected to the PLC.
 The power supply is the section that provides the PLC with
the voltage and current it needs to operate.

The Input/output System


The input/output (I/O) system is the section of a PLC to which all of
the field devices are connected. If the CPU can be thought of as the
brains of a PLC, then the I/O system can be thought of as the arms and
legs.

 The I/O system is what actually physically carries out the


control commands from the program stored in the PLC’s
memory.
 The I/O system consists of two main parts:
 the rack
 I/O modules
12

 The rack is an enclosure with slots in it that is connected to the CPU.

 I/O modules are devices with connection terminals to which the field
devices are wired.

 Together, the rack and the I/O modules form the interface between
the field devices and the PLC. When set up properly, each I/O
module is both securely wired to its corresponding field devices and
securely installed in a slot in the rack. This creates the physical
connection between the field equipment and the PLC. In some small
PLCs, the rack and the I/O modules come prepackaged as one unit.

A LITTLE MORE ABOUT INPUTS AND OUTPUTS


 All of the field devices connected to a PLC can be classified in one of
two categories:
 inputs
 outputs
 Inputs are devices that supply a signal/data to a PLC. Typical
examples of inputs are push buttons, switches, and measurement
devices.
 Outputs are devices that await a signal/data from the CPU to
perform their control functions. Lights, horns, motors, and valves
are all good examples of output devices.

Example
13

An overhead light fixture and its corresponding wall switch are good
examples of everyday inputs and outputs. The wall switch is an input – it
provides a signal for the light to turn on. The overhead light is an output -
it waits until the switch sends a signal before it turns on.

Input Devices

Output devices
14

There are two basic types of input and output devices:


 discrete
 analog

 Discrete devices are inputs and outputs that have only two states:
on and off. As a result, they send/receive simple signals to/from a
PLC. These signals consist of only 1s and 0s. A 1 means that the
device is on and a 0 means that the device is off.
 Analog devices are inputs and outputs that can have an infinite
number of states. These devices can not only be on and off, but
they can also be barely on, almost totally on, not quite off, etc.
These devices send/receive complex signals to/from a PLC. Their
communications consist of a variety of signals, not just 1s and 0s.

Discrete Inputs
15

A Normally Open (NO) pushbutton is used in the following example.


One side of the pushbutton is connected to the first PLC input. The other
side of the pushbutton is connected to an internal 24 VDC power supply.
Many PLCs require a separate power supply to power the inputs. In the
open state, no voltage is present at the PLC input. This is the OFF
condition. When the pushbutton is depressed, 24 VDC is applied to the
PLC input. This is the ON condition.

A thermometer and a control valve are examples of the other type


of I/O devices - analog. A thermometer is an analog input device because
it provides data that can have an infinite number of states. Temperature
Isn’t just hot or cold. It can have a variety of states, including warm, cool,
moderate, etc. A control valve is an analog output for the same reason. It
can be totally on or totally off, but it can also have an infinite number of
settings between these two states.

Analog Input example:

A level transmitter monitors the level of liquid in a tank. Depending


on the level transmitter, the signal to the PLC can either increase or
decrease as the level increases or decreases.
16

Analog output example:

An analog output is an output signal that has a continuous signal.


The output may be as simple as a 0-10 VDC level that drives an analog
meter. Examples of analog meter outputs are speed, weight, and
temperature. The output signal may also be used on more complex
applications such as a current-to-pneumatic transducer that controls an
air-operated flow-control valve.

Because different input and output devices send different kinds of


signals, they sometimes have a hard time communicating with the PLC.

While PLCs are powerful devices, they can’t always speak the
“language” of every device connected to them. That’s where the I/O
modules we talked about earlier come in. The modules act as
“translators” between the field devices and the PLC. They ensure that
the PLC and the field devices all get the information they need in a
language that they can understand.
17

Using Transducers

Position, level, temperature, pressure, flow and speed are just some
of the measurements that analog devices can provide to a control system.
You are probably asking yourself: “How does pressure, which is a physical
quantity, become an electrical signal?” That is a great question! The
conversion is done using transducers. A transducer will take a physical
quantity like pressure and convert it to an electrical signal. A lot of
transducers use the physical quantity to control the resistance in the
electrical circuit. For example, an RTD (Resistance Temperature Detector)
will change its resistance value based on heat. As heat increases so does
the resistance in the circuit, altering the supplied voltage or current. Same
holds true for pressure transducers that use strain gauges. As pressure is
applied to the strain gauge, the resistance in the circuit goes up and the
voltage or current level changes. Some flow detectors will use the flow of
a fluid to push a fin that is connected to a rotary potentiometer. Faster
flow equals more resistance change. One of the coolest transducers that I
ran across in my days working in the offshore oil industry was the sand
detector. This transducer was acoustic and was attached to pipes that
were drawing oil out from the sea floor. It would actually listen for sand
rubbing against the inside of the pipe. The amount of sound was
converted into an analog signal used to alert personnel if the drilling was
drawing out too much sand, which could collapse the well. The electrical
signals that transducers provide can be voltage or current based. 4 to
20mA, 0 to 20mA, 0 to 10VDC and -10 to +10 VDC are a few of the
available ranges produced by transducers. The PLC supplies the voltage or
current and the transducer will return a value in its configured range. That
value will be proportional to the amount of pressure, flow, etc. that is
present. We now arrive at two important parts of this discussion: scaling
and resolution.

The Memory System

The memory system is the section of the CPU that stores both the
control program and data from the equipment connected to the PLC.

The control program is the computer program stored in the PLC’s


memory that tells the PLC what’s supposed to be going on in the
system. The use of a PLC to provide the wiring connections between
system devices is called soft wiring.
18

The soft wiring advantage provided by programmable controllers is


tremendous. In fact, it is one of the most important features of PLCs.

Soft wiring makes changes in the control system easy and cheap. If
you want a device in a PLC system to behave differently or to control a
different process element, all you have to do is change the control
program.

In a traditional system, making this type of change would involve


physically changing the wiring between the devices, a costly and time-
consuming endeavor.

Example:

 Let’s say that two push buttons, PB1 and PB2, are connected to a
PLC. Two pilot lights, PL1 and PL2, are also connected to the PLC.
The way these devices are connected, pressing push button PB1
turns on pilot light PL1 and pressing push button PB2 turns on pilot
light PL2.
 Let’s say that you want to change this around so that PB1 controls
PL2 and PB2 controls PL1.
 In a traditional system, you would have to rewire the circuit so that
the wiring from the first push button goes to the second pilot light
and vice versa. However, because these devices are connected to a
PLC, making this change is as simple as making a small change in
the control program.

Scan Time

 The scan time is normally continuous and sequential process of


reading the status of inputs, evaluating the control logic and
updating outputs. Scan time specification indicates how fast the
controller can react to the field inputs and correctly solve the control
logic.

SO HOW DOES A PLC KEEP ALL THIS STRAIGHT?


 A PLC memory system is very complex, allowing it to store
information not only about the control program but about the status
of all the inputs and outputs as well. To keep track of all this
information, it uses a system called addressing.
 An address is a label or number that indicates where a certain piece
of information is located in a PLC’s memory. Just like your home
19

address tells where you live in your city, a device or piece of data’s
address tells where information about it resides in the PLC’s
memory. That way, if a PLC wants to find out information about a
field device, it knows to look in its corresponding address location.
 Some addresses contain information about the status of particular
field devices. Other addresses store data that’s the result of control
program computations. Still others contain reference data entered
by the system programmer.
 Nonetheless, no matter what type of data it is, a PLC uses its
addressing scheme to keep track of it all. That way, it’ll have the
right data when it needs it.

PLC Address

TO SUM IT ALL UP...

 All PLCs follow the basic rules of operation we’ve just discussed. All
PLCs have a CPU and an input/output system. They also all use a
control program, instructions, and addressing to make the
equipment in the control system do what it’s supposed to do.
 And no matter how many bells and whistles you add to it, every PLC
does the same three things: (1) examines its input devices, (2)
executes its control program, and (3) updates its output devices
accordingly.
 So in reality, understanding PLCs is as simple as 1-2-3!

Another view of PLC Scan

 The PLC program is executed as part of a


repetitive process referred to as a scan.
 A PLC scan starts with the CPU reading the
status of inputs. The application program is
20

executed using the status of the inputs. Once the program is


completed, the CPU performs internal diagnostics and
communication tasks. The scan cycle ends by updating the outputs,
then starts over.
 The cycle time depends on the size of the program, the number of
I/Os, and the amount of communication required

Software

Software is any information in a form that a


computer or PLC can use. Software includes the
instructions or programs that direct hardware.

Hardware

Hardware is the actual


equipment. The PLC, the programming
device, and the connecting cable are
examples of hardware.

Memory Size

Kilo, abbreviated K, normally refers to 1000 units. When talking


about computer or PLC memory, however, 1K means 1024. This is
because of the binary number system (210=1024). This can be 1024 bits,
1024 bytes, or 1024 words, depending on memory type.
21

RAM
 Random Access Memory (RAM) is memory where data can be
directly accessed at any address. Data can be written to and read
from RAM. RAM is used as a temporary storage area.
 RAM is volatile, meaning that the data stored in RAM will be lost if
power is lost. A battery backup is required to avoid losing data in
the event of a power loss.

ROM

 Read Only Memory (ROM) is a type of memory that data can be read
from but not written to. This type of memory is used to protect data
or programs from accidental erasure.
 ROM memory is nonvolatile. This means a user program will not lose
data during a loss of electrical power. ROM is normally used to store
the programs that define the capabilities of the PLC.

EPROM

 Erasable Programmable Read Only Memory (EPROM) provides some


level of security against unauthorized or unwanted changes in a
program. EPROMs are designed so that data stored in them can be
read, but not easily altered.
 Changing EPROM data requires a special effort. UVEPROMs
(ultraviolet erasable programmable read only memory) can only be
erased with an ultraviolet light.
22

 EEPROM (electronically erasable programmable read only memory),


can only be erased electronically.

Firmware

 Firmware is user or application specific software burned into EPROM


and delivered as part of the hardware.
 Firmware gives the PLC its basic functionality.

Program space

 Program space stores the ladder logic (LAD) or statement list (STL)
program instructions.
 This area of memory controls the way data space and I/O points are
used. LAD or STL instructions are written using a programming
device such as a PC, then loaded into program memory of the PLC.

Data space

 Data space is used as a working area, and includes memory


locations for calculations, temporary storage of intermediate results
and constants.
 Data space includes memory locations for devices such as timers,
counters, high-speed counters, and analog inputs and outputs.
 Data space can be accessed under program control.

Configurable parameter space

 Configurable parameter space, or memory, stores either the default


or modified configuration parameters.
23

Putting it Together!

Creating or changing a
program

 In order to create or
change a program, the
following items are
needed:
 PLC
 Programming
Device
 Programming
Software
 Connector Cable

Connector Cables PPI (Point-to-Point Interface)

Connector cables are required to transfer data from the


programming device to the PLC. Communication can only take place when
the two devices speak the same language or protocol. Communication
between a Siemens programming device and the S7-200 is referred to as
PPI protocol (point-to-point interface). An appropriate cable is required for
a programming device such as a PG 720 or PG 740. The S7-200 uses a 9-
pin, D-connector. This is a straight-through serial device that is compatible
with Siemens programming devices (MPI port) and is a standard connector
for other serial interfaces.
24

A special cable, referred to as a PC/PPI cable, is needed when a


personal computer is used as a programming device. This cable allows the
serial interface of the PLC to communicate with the RS-232 serial interface
of a personal computer. DIP switches on the PC/PPI cable are used to
select an appropriate speed (baud rate) at which information is passed
between the PLC and the computer.

THIN

Differentiate Analog and Digital Signals.

 MODULE
SUMMARY

In module III, The PLC System. You have learned about PLC control
systems, the different programming methods, and how the PLC process
signals its instructions.
There are two lessons in Module III. Lesson 1 discussed PLC
Programming and how to read ladder logic.
Lesson 2 deals with different elements of PLC: Central Processing
Unit (CPU), Input / Output Devices, Memory System, Software, and
Hardware.

Congratulations! You have just studied Module II!


25

 SUMMATIVE
TEST

Enumerate the following:


1. 3 Types of PLC Programming Language
______________________________________________
______________________________________________
______________________________________________

2. 2 basic types of Input and Output Devices


______________________________________________
______________________________________________

3. 5 examples of Input Devices


______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________

4. 5 Examples of Output Devices


______________________________________________
26

______________________________________________
______________________________________________
______________________________________________
______________________________________________

5. The items needed to create or change a program


_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy