0% found this document useful (0 votes)
501 views44 pages

PLC Unit 2-1 PDF

This document discusses the programming equipment, devices, and techniques used for programming programmable logic controllers (PLCs). It covers: 1. The main equipment is a computer running Windows XP with at least 128MB RAM, a USB port, and 200MB free disk space. A USB to serial port converter is also needed to connect older PLCs. 2. Common programming techniques include ladder logic, function block diagrams, and sequential function charts - each with their own strengths for visualizing control flows. 3. Ladder logic fundamentals include the basic diagram framework with power rails and reference designators to identify components, as well as Boolean and relay logic principles.

Uploaded by

Mahesh Shende
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)
501 views44 pages

PLC Unit 2-1 PDF

This document discusses the programming equipment, devices, and techniques used for programming programmable logic controllers (PLCs). It covers: 1. The main equipment is a computer running Windows XP with at least 128MB RAM, a USB port, and 200MB free disk space. A USB to serial port converter is also needed to connect older PLCs. 2. Common programming techniques include ladder logic, function block diagrams, and sequential function charts - each with their own strengths for visualizing control flows. 3. Ladder logic fundamentals include the basic diagram framework with power rails and reference designators to identify components, as well as Boolean and relay logic principles.

Uploaded by

Mahesh Shende
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/ 44

PLC &SCADA

Unit 02: Programming of Plc


Programming Equipment
1) Computer ( Desktop or Laptop )
– This is the main equipment .the minimum specification for hardware and software are given
below:

Hardware

PENTIUM II 350 processor or above

 32 Mb RAM ( Microsoft Window 98/ME ),64 Mb ( Microsoft Window NT/2000 ),128Mb


( Microsoft Window XP )
 Have USB port
 Serial port
 CD ROM drive
 Hard Disk at least 200 Mb free space

Software

The best Operating system ( OS ) is a Microsoft Window XP professional.It very user friendly
and compatible with all types of PLC programming software.It also not have issue
communication between Window Vista or Window 7 is also used for programming but some
PLC programming software not compatible with it.It also facing a connection port error.It need
another setting to avoid communication error with PLC.

2) Port Converter cable USB to RS232


– Serial port or RS232 is common port for PLC programming.This converter is very important
because in market now,serial port ( RS232 ) not built in on laptop.So we can use the converter to
link our laptop to PLC with RS232 port.Now in market,manufacture produce various types of
converter cable completed with driver and we can get with a cheap price.

USB to RS232 ( serial port ) converter cable

3) PLC communication Cable


– To communicate with computer and PLC,we need a communication cable. It depend on types
and brands of PLC.We can get it from PLC manufacture base on PLC model because it deference
size and type of port connector.

For example : Mitsubishi communication cable for FX type.

4) PLC software
– This software is provide by PLC manufacture.They design the software to integrate computer
with PLC to easy programming task.I already discuss about several PLC software commonly
used in industry such as Mitsubishi,Omron,Keyence,Siemens,Allen Bradly and others
more.Please refer to my last post on PLC programming software.

OR

Various types of programming devices are used to enter, modify and troubleshoot a PLC
program. These programming terminal devices include handheld and PC based devices. In the
handheld programming device method, a proprietary device is connected to PLC through
a connecting cable. This device consists of a set of keys that allows to enter, edit and dump the
code into the PLC. These handheld devices consist of small display to make the instruction that
has been programmed visible. These are compact and easy to use devices, but these handheld
devices have limited capabilities.

PLC Programming Devices

Most popularly a Personal Computer (PC) is used for programming the PLC in conjunction with
the software given by the manufacturer. By using this PC we can run the program in either online
or offline mode, and can also edit, monitor, diagnose and troubleshoot the program of the PLC.
The way of transferring the program to the PLC is shown in the above figure wherein the PC
consists of program code corresponding to control application which is transferred to the PLC
CPU via programming cable.
VARIOUS TECHNIQUES OF PROGRAMMING

1)Ladder Diagram

This is the most common of the PLC Methods. The diagram looks like a wiring schematic for a
relay circuit with the power line on the left and the outputs on the right. This is the main
programming method for PLCs in industrial controls. It is referred to as a ladder diagram because
when you look at it, it looks like a ladder with the inputs and outputs of the program contained on
each rung. As an example, you have a proximity sensor that when triggered, sends 24VDC to the
PLC. In the program, you want that trigger to power on a motor. The rung for that sequence will
look like this: --||-----( )--, where --||-- represents the input from the proximity sensor and –(
)--represents the motor output. Ladder logic was based off the circuit diagrams used to run
relay logic hardware. The term stems from the look of the programming language and its
resemblance to ladders, with two vertical rails and series of horizontal rungs between them

2)Function Block Diagram

The function block diagram method is also a pictorial method of programming. It consists of
blocks for each function that show the inputs and outputs for more complex sequences and lines
drawn between each block illustrating what each output will do and what will affect each input.
For example, you may have a scale in your process and if you want an alarm to sound if the
weight measured on the scale is too high or too low, then the scale will have a box with the line
drawn from the weight output to the variable input of the alarm box. The output of the alarm box
for either the too high or too low alarm will go to an alarm horn and/or ligh Function block
diagrams visualize signal and data flows in a block diagram and show the function between
input and output variables. A function is described as a set of blocks with the input and output
variables connected by connection lines. An input variable could be connected to an input of
block, and the output of that block could return an output variable or connect to another block.

3)Sequential Function Chart

The sequential function chart method is another pictorial method. It most closely resembles a
flow chart, only it’s more complex. There are three primary elements in a sequential function
chart: steps, actions and transitions. Each step contains the logic for a particular portion of the
process. As an example: weighing an item, checking for alarms and sounding the alarm if the
weight is out of limits. The actions are the individual activities of performing the steps.
Transitions move the process from one step to the next. The sequential function chart coordinates
large, complicated programming tasks into smaller, more manageable functions. It breaks a
sequential task down into steps, transitions and actions. Steps can be active or inactive, with
actions only executed when the step is active. Transitions define logical conditions that allow
the process to move from the existing step to the next one. Actions can defined as set, reset or
continuous.

4)Structured Text

This is a text language and is not used often with PLCs, though many manufacturers do allow for
this within their PLCs' programming software. It is very similar to Pascal or BASIC, and for
people trained with computer programming, it can be the easiest. Complex math or decision
making processes are often easier to accomplish with structured text as it can be done on one page
versus many rungs of a ladder diagram Structured text is block structured with syntax based on
the Pascal programming language. It is a high level text language that encourages structured
programming. The variables and function calls are defined by common elements shared
between them, which allows for different programming languages and methods to be used
together in the same program as long as they satisfy IEC 61131-3..

5)Instruction List

The instruction list method is probably the most complicated method, as it most closely resembles
Assembly language. This can be useful for processes that repeat a small function often. Though it
is a powerful method, it is often easier to just program the process in a ladder diagram than it is to
learn how to program with an instruction list. Program control is acheived by jump instructions
and function calls, which are like subroutines with optional parameters.

This low level text language is similar to the assembly programming language. The variables
and function calls are defined by common elements, much like in the structured text method
outline above

LADDER DIGRAM FUNDAMENTALS

1)Basic Diagram Framework


All electrical machine diagrams are drawn using a standard format. This format is called the
ladder diagram. Beginning with the control transformer, we add a protective fuse on the left
side.From the transformer/fuse combination, horizontal lines are drawn to both sides and then
drawn vertically down the page as shown in Figure 1-18. These vertical lines are called power
rails or simply rails or upright
2)Wiring
The wires are numbered. In our diagram, the left rail is wire number 2 and the right rail is wire
number 1. When the system is constructed, the actual wires used to connect the components will
have a label on each end (called a wire marker This makes it easier to build, troubleshoot, and
modify the circuitry. In addition, by using wire markers, all the wires will be identified, making
it unnecessary to use more than one color wire to wire the system, which reduces the cost to
construct the machine. Generally, control circuits are wired with all black, red or white wire (do
not use green - it is reserved for safety ground wiring).
3)Reference Designators
For all electrical diagrams, every component is given a reference designator. This is a label
assigned to the component so that it can be easily locatedThe reference designator for each
component appears on the schematic diagram, the mechanical layout diagram, the parts list, and
sometimes is even stamped on the actual component itself. Some of the most commonly used
T_ transformer TDR or TR time delay relay
M -motor, or motor relay L -indicator lamp or line phase
F- fuse CB- circuit breaker
OL -overload switch or overload contact R -resistor.
CR -control relay S -switch
C –capacitor SS- selector switch
LS- limit switch
PB -pushbutton
4) Boolean Logic and Relay Logic
Since the relays in a machine perform some type of control operation, it can be said that they
perform a logical function. As with all logical functions, these control circuits must consist of
the fundamental AND, OR, and INVERT logical operations. Relay coils, N/C contacts, and N/O
contacts can be wired to perform these same fundamental logical functions

5)Ground Test
Earlier, we drew a ladder diagram of some switch circuits which included the control transformer.
We connected the right side of the transformer to ground (the frame of the machine). For safety
reasons, it is necessary to occasionally test this ground to be sure that is it still connected because
loss of the ground circuit will not affect the performance of the machine and will therefore go
unnoticed. This test is done using a ground test circuit, and is shown in Figure 1-29.

6)The Latch (with Sealing/Latching Contacts)


Occasionally, it is necessary to have a relay “latch” on so that if the device that activated the relay
is switched off, the relay remains on. This is particularly useful for making a momentary
pushbutton switch perform as if it were a maintained switch. Consider, for example, the
pushbuttons that switch a machine on and off. This can be done with momentary pushbuttons if
we include a relay in the circuit that is wired as a latch as shown in the ladder diagram segment
Figure 1-30 (the transformer and fuse are not shown for clarity)

7)Single Cycle
When actuated, the machine must perform only one cycle and then stop, even if the operator is
still depressing the RUN switches. This prevents surprises and possible injury for the operator
if the machine should inadvertently go through a second cycle. Therefore, circuitry is usually
needed to assure that once the machine has completed one cycle of operation, it stops and waits
for the RUN switch(es) to be released and then pressed again

PROPER CONSTRUCTION OF LADDER DIAGRAM--

Ladder Diagram :
• First Step : Translate all of the items we're using into symbols the PLC
understands.

• Second step : We must tell the PLC where everything is located. In


other words we have to give all the devices an address.

• Final step : We have to convert the schematic into a logical sequence


of e
vents.

First Step :

• The PLC doesn't understand terms like switch, relay, bell, etc.

• It prefers input, output, coil, contact, etc.

• It doesn't care what the actual input or output device actually is. It only
cares that its an input or an output.

• First we replace the battery with a symbol. This symbol is common to


all ladder diagrams. We draw what are called bus bars.

• These simply look like two vertical bars. One on each side of the
diagram. Think of the left one as being + voltage and the right one as
being ground. Further think of the current (logic) flow as being from left
to right.

• Next we give the inputs a symbol. In this basic example we have one
real world input. (i.e. the switch).

• We give the input that the switch will be connected to the symbol
shown below. This symbol can also be used as the contact of a relay.
• Next we give the outputs a symbol. In this example we use one output
(i.e. the bell).

• We give the output that the bell will be physically connected to the
symbol shown below. This symbol is used as the coil of a relay.

• The AC supply is an external supply so we don't put it in our ladder.


The PLC only cares about which output it turns on and not what's
physically connected to it.

Second Step :

• We must tell the PLC where everything is located. In other words we


have to give all the devices an address.

• Where is the switch going to be physically connected to the PLC? How


about the bell We start with a blank road map in the PLCs town and give
each item an address.

• Could you find your friends if you didn't know their address? You
know they live in the same town but which house? The plc town has a
lot of houses (inputs and outputs) but we have to figure out who lives
where (what device is connected where).

• We'll get further into the addressing scheme later. The PLC
manufacturers each do it a different way! For now let's say that our input
will be called "0000". The output will be called "500".

Final Step :
• Convert the schematic into a logical sequence of events.

• The program we're going to write tells the PLC what to do when
certain events take place.

• In our example we have to tell the plc what to do when the operator
turns on the switch.

• Final converted diagram.

• We eliminated the real world relay from needing a symbol.

BASIC COMPONENTS AND THEIR SYMBOLS IN LADDER DIAGRAM

1)Load :

• The load(LD) instruction is a normally open contact. It is sometimes


also called examine if on (XIO).(as in examine the input to see if its
physically on). The symbol for a load instruction is shown below.

• This is used when an input signal is needed to be present for the


symbol to turn on.
• When the physical input is on we can say that the instruction is True.

• We examine the input for an on signal. If the input is physically on


then the symbol is on.

• An on condition is also referred to as a logic 1 state.

2) Load Bar :

• The Load bar instruction is a normally closed contact. It is sometimes


also called LoaDNot or examine if closed(XIC)(as in examine the input
to see if its physically closed) The symbol for a loadbar instruction is
shown below.

• This is used when an input signal does not need to be present for the
symbol to turn on.

• When the physical input is off we can say that the instruction is True.

• We examine the input for an off signal. If the input is physically off
then the symbol is on.

• With most PLCs this instruction(Load or Loadbar) MUST be the first


symbol on the left of the ladder.

3) Out :
• The Out instruction is sometimes also called an Output Energize
instruction. The output instruction is like a relay coil. Its symbol looks
as shown below.

• When there is a path of True instructions preceding this on the ladder


rung, it will also be True.

• When the instruction is True it is physically ON.

• We can think of this instruction as a normally open output.

4) Out Bar :

• The Outbar instruction is sometimes also called an OutNot instruction.

• The Outbar instruction is like a normally closed relay coil. Its symbol
looks like that shown below.

3) Control Transformer
In order to make large powerful machines efficient and cost effective
and reduce line current, most are powered by high voltages (240VAC,
480VAC, or more). This means the line voltage must be reduced to
120VAC or less for the controls. This is done using a control
transformer.
Figure 1-1 shows the electrical diagram symbol for a control
transformer. The most obvious peculiarity here is that the symbol is
rotated 90° with the primaries on top and secondary on the bottom. As
will be seen later, this is done to make it easier to draw the remainder of
the ladder diagram. Notice that the transformer has two primary
windings. These are usually each rated at 240VAC. By connecting
them in parallel, we obtain a 240VAC primary, and by connecting them
in series, we have a 480VAC primary. The secondary windings are
generally rated at 120VAC, 48VAC or 24VAC.

4) Fuse
Control circuits are always fuse protected. This prevents damage to the control transformer in
the event of a short in the control circuitry. The electrical symbol for a fuse is shown in Figure
1-2. The fuse used in control circuits is generally a slo-blow fuse (i.e. it is generally immune
to current transients which occur when power is switched on) and it must be connected in series
with the transformer secondary.

5)Switches (Explain types of switeches)


There are two fundamental uses for switches. First, switches are used for operator input to
send instructions to the control circuit. Second, switches may be installed on the moving parts
of a machine to provide automatic feedback to the control system. There are many different
types of switches
1)Pushbuttons
The most common switch is the pushbutton It is also the one that needs the least description
because it is widely used in automotive and electronic equipment applications. There are two
types of pushbutton, the momentary and maintained.
a)The momentary pushbutton switch is activated when the button is pressed, and deactivated
when the button is released. The deactivation is done using an internal spring The contacts
on switches can be of two types. These are normally open (N/O) and normally closed
(N/C). Whenever a switch is in it’s deactivated position, the N/O contacts will be open
(non-conducting) and the N/C contacts will be closed (conducting). The symbol on the right
of Figure 1-4 is a single pushbutton with both N/O and N/C contacts. There is no internal
electrical connection between different contact pairs on the same switch. Most industrial
switches can have extra contacts “piggy backed” on the switch, so as many contacts as
needed of either type can be added by the designer.

b) The maintained pushbutton activates when pressed, but remains activated when it is released.
Then to deactivate it, it must be pressed a second time. For this reason, this type of switch is

sometimes called a push-push switch. Note that it is the symbol for the momentary pushbutton
with a “see-saw” mechanism added to hold in the switch actuator until it is pressed a second
time.

c) flush pushbutton :The switch has an actuator that is aligned to be even with the sleeve. It is
called a flush pushbutton. It provides similar protection against accidental actuation

2) The mushroom head switch

It is always red and the switch is used to shutoff power to the controls of a machine when the
switch is pressed in. Mushroom head switches have special schematic symbols as shown in
Figure 1-8. Notice that they are drawn as standard pushbutton switches but have a curved line
on the top of the actuators to indicate that the actuators have a mushroom head

3) Selector Switches
A selector switch is also known as a rotary switch. An automobile ignition switch, and an
oscilloscope’s vertical gain and horizontal time base switches are examples of selector switches.
Selector switches use the same symbol as a momentary pushbutton, except a lever is added to
the top of the actuator, as shown in Figure 1-9. The switch on the left is open when the
selector is turned to the left and closed when turned to the right. The switch on the right side
has two sets of contacts. The top contacts are closed when the switch selector is turned to the
left position and open when the selector is turned to the right. The bottom set of contacts work
exactly opposite. There is no electrical connection between the top and bottom pairs of
contacts. In most cases, we label the selector positions the same as the labeling on the panel
where the switch is located. For the switch on the right in Figure 1-9, the control panel would
be labeled with the STOP position to the left and the RUN position to the right.

4) Limit Switches
Limit switches are usually not operator accessible. Instead they are activated by moving parts
on the machine. They are usually mechanical switches, but can also be light activated (such as
the automatic door openers used by stores and supermarkets), or magnetically operated (such as
the magnetic switches used on home security systems that sense when a window has been
opened). An example of a mechanically operated limit switch is the switch on the refrigerator
door that turns on the light inside. They are sometimes called cam switches because many are
operated by a camming action when a moving part passes by the switch. The symbols for both
types of limit switches are shown in Figure 1-10. The N/O version is on the left and the N/C
version is on the right. One of the many types of limit switch is
pictured in Figure 1-11.

6)Indicator Lamps
All control panels include indicator lamps. They tell the operator when power is applied to
the machine and indicate the present operating status of the machine. Indicators are drawn as a
circle with “light rays” extending on the diagonals as shown in Figure 1-12. Although the light
bulbs used in indicators are generally incandescent (white), they are usually covered with
colored lenses. The colors are usually red, green, or amber, but other colors are also available.
Red lamps are reserved for safety critical indicators (power is on, the machine is running, an
access panel is open, or that a fault has occurred). Green usually indicates safe conditions
(power to the motor is off, brakes are on, etc.). Amber indicates conditions that are important
but not dangerous (fluid getting low, machine paused, machine warming up, etc

7) Relay
A relay, or contactor, is an electromagnetic device composed of a frame (or core) with an
electromagnet coil and contacts The movable contacts (and conductor that connects them) are
mounted via an insulator to a plunger which moves within a bobbin.
Referring to Figure 1-13, when the coil is de-energized, the movable contacts are connected to
the upper fixed contact pair. These fixed contacts are referred to as the normally closed
contact. Likewise, the movable contacts are not connected to the lower fixed contact pair when
the relay coil is de-energized. These fixed contacts are referred to as the normally open
contacts. The coil symbol shown in Figure represents the coil of the relay we have been
discussing. The coil, like the contacts, has two connection lines extending from either side.
These represent the physical wire connections to the coil on the actual relay.

8) Time Delay relay


There are two basic types of time delay relay.
1) Delay-On Timer (TON) Relay
Delay-on relays are useful for delaying turn-on events. For example, when the
motor is started on a machine, a TON time delay relay can be used to disable all
the other controls for a few seconds until the motor has had time to achieve
running speed.
2)Delay-Off Timer (TOF) Relay
Delay-off time delay relays are excellent for applications requiring time to be
“stretched”. As an example, it can be used to operate a fan that continues to cool
the machine even after the machine has been stopped

RULES TO DRAW LADDER DIGRAM


1. Inputs can be used in series as well as parallel to form a connection.

The number of inputs (I1, I2, I3, I4, ……In) can link with different outputs (Q1,
Q2,…..Qn) by using series or parallel connection.

In the below figure, the three Inputs (I1, I2, and I3) are connecting in series and four
Inputs (I1, I2, I3 and I4) are connecting in parallel with the Single output (Q1 and
Q2) respectively.

So we can connect the inputs in series or parallel as per our programming


requirement.

Note: In the program, AND gate follows the series connections and OR gate
follows the parallel connection. For detail, do read logic gates in PLC ladder
programming.
Figure 1: Inputs Representations in series and parallel connection
2. Outputs (or coil) can be used only in parallel.

According to the second rule, outputs (Q1, Q2, Q3, Q4, ……Qn) are connected in
parallel along with the single input (I1). Refer the image below.

If the single input (I1) is normally closed (NC contact) then all outputs (Q1, Q2,
Q3, Q4,….Qn) will be activated (On).

Figure 2: Outputs in parallel


3. One input can be used in multiple times in one program.

As per the third rule, a single input can be used to repeatedly in the different rungs.

From the below image, the program has different outputs but the same input
(switch) connected.
Figure 3: Single input with different outputs
4. One output cannot be used multiple times in one program, except in
set/reset and latch/ unlatch functions.

In the function set/reset, the same output address is used. And it can be connected to
the same or different inputs.

As per the below image, different inputs (I1 and I2) are linked with the single
output (Q1) using the set and reset function.

When the Input (I1) is pressed, the output coil will be set ( i.e. Q1 on activate
mode). And when the input (I2) is pressed, the output coil will be reset ( i.e. Q1 on
deactivate mode).

Figure 4a: Set or Reset Coil (Same output address)


In latch/unlatch function, working is the same as set/reset function. The only
difference is, the first input (I1) is normally opened (NO) and the second input (I2)
is normally closed (NC).
The lanch/unlatch function is useful for the cycling process.

Figure 4b: Latch or Unlatch Coil (Same output address)


5. Input address cannot be used as an output address.

The same input address can be used as multiple inputs. And it can not be used as
output.

Figure 5: Input address


6. Outputs address can be used as inputs address.
The last rule is for the cycling process (i.e. process continuous from start to end).In
the image below, the output coil works as the input coil with the use of
latch/unlatch function.
Figure 6: Output address

LATCH INSTRUCTION :

• The latching instructions let us use momentary switches and program the plc so
that when we push one the output turns on and when we push another the output
turns off.

• Picture the remote control for your TV. It has a button for ON and another for
OFF :

- When I push the ON button the TV turns on.


- When I push the OFF button the TV turns off.

• I don't have to keep pushing the ON button to keep the TV on. This would be
the function of a latching instruction.

• The latch instruction is often called a SET or OTL (output latch).

• The unlatch instruction is often called a RES (reset), OUT (output unlatch) or
RST (reset). The diagram below shows how to use them in a program.
Here we are using 2 momentary push button switches. One is physically
connected to input 0000 while the other is physically connected to input 0001.
When the operator pushes switch 0000 the instruction "set 0500" will become true
and output 0500 physically turns on. Even after the operator stops pushing the
switch, the output (0500) will remain on. It is latched on. The only way to turn off
output 0500 is turn on input 0001. This will cause the instruction "res 0500" to
become true thereby unlatching or resetting output 0500.

• What would happen if input 0000 and 0001 both turn on at the exact same time.

• Will output 0500 be latched or unlatched?

• To answer this question we have to think about the scanning sequence. The
ladder is always scanned from top to bottom, left to right.

• The first thing in the scan is to physically look at the inputs.


• 0000 and 0001 are both physically on.

• Next the PLC executes the program.

• Starting from the top left, input 0000 is true therefore it should set 0500.

• Next it goes to the next rung and since input 0001 is true it should reset 0500.

• The last thing it said was to reset 0500. Therefore on the last part of the scan
when it updates the outputs it will keep 0500 off. (i.e. reset 0500).

Counters :

• A counter is a simple device intended to do one simple thing - count.

• There are up-counters(they only count up 1,2,3...). These are called CTU,(count
up) CNT,C, or CTR.

• There are down counters(they only count down 9,8,7,...). These are typically
called CTD (count down).

To use Counters we must know 3 things :

• Where the pulses that we want to count are coming from. Typically this is from
one of the inputs.(a sensor connected to input 0000 for example).

• How many pulses we want to count before we react. Let's count 5 widgets
before we box them, for example.

• When/how we will reset the counter so it can count again. After we count 5
widgets lets reset the counter, for example.
• In this counter we need 2 inputs :

- One goes before the reset line. When this input turns on the current
(accumulated) count value will return to zero.
- The second input is the address where the pulses we are counting are coming
from.

• Cxxx is the name of the counter. If we want to call it counter 000 then we would
put "C000" here.

• yyyyy is the number of pulses we want to count before doing something.


Timers :

• TIMER : It is an instruction that waits a set amount of time before doing


something.

• Type of Timers : On-Delay Timer and Off-Delay Timer.

On-Delay Timer :

• Simply "delays turning on".

• After sensor (input) turns ON, wait x-seconds before activating a solenoid
valve(output).

• This is the most common timer. It is often called TON(timer


on-delay), TIM(timer) or TMR(timer).

Off-Delay Timer :

• Simply "delays turning off".

• After sensor (input) sees a target it turn on a solenoid (output).

• When the sensor no longer sees the target it hold the solenoid on for x-seconds
before turning it off.

• It is called a TOF (timer off-delay).

Need to know 2 things :

• What will enable the timer :

- Typically this is one of the inputs,(a sensor connected to input 0000 for
example).

• How long we want to delay before we react.


- Let's wait 5 seconds before we turn on a solenoid, for example.

On-Delay Timer :

• Txxx : Timer Name.

• When the enable input is ON the timer starts to tick.

• When it ticks yyyyy (the preset value) times, it will turn on its contacts that we
will use later in the program.

Timer in Ladder Diagram :

• Wait for input 0001 to turn on.

• Timer T000 (a 100ms increment timer) starts ticking. It will tick 100 times.
Each tick (increment) is 100ms so the timer will be a 10000ms (i.e. 10 second)
timer.

• 100ticks X 100ms = 10,000ms.

• When 10 seconds have elapsed, the T000 contacts close and 500 turns on.

• When input 0001 turns off (false) the timer T000 will reset back to 0 causing its
contacts to turn off (become false) thereby making output 500 turn back off.

One Shot :

• A one-shot is used to make something happen for ONLY 1 SCAN.

• Most manufacturers have one-shots that react to an off to on transition and a


different type that reacts to an on to off transition.

• Some names for the instructions could be DIFU/DIFD(differentiate


up/down), SOTU/SOTD(single output up/down), OSR (one-shot rising) and
others.

Master Controls :

• Master controls can be thought of as "emergency stop switches".

• An emergency stop switch typically is a big red button on a machine that will
shut it off in cases of emergency.

• The master control instruction typically is used in pairs with a master control
reset.

• It is commonly abbreviated as MC/MCR(master control/master control reset).

• Timers should not be used inside the MC/MCR block

Shift Registers :
• To store many previous events and act upon them later.

• We use a register or group of registers to form a train of bits (cars) to


store the previous on/off status. Each new change in status gets stored in
the first bit and the remaining bits get shifted down the train.

• SFT (ShiFT), BSL (Bit Shift Left), SFR (Shift Forward Register).

• BSR (Bit Shift Right) and SFRN (Shift Forward Register Not).

Symbol needs 3 inputs and has some data inside the symbol : 1000:
First Bit, 1003 : Last Bit.

• Data : The data input gathers the true/false statuses that will be shifted
down the train. When the data input is true the first bit (car) in the
register (train) will be a 1. This data is only entered into the register
(train) on the rising edge of the clock input.

• Clock : The clock input tells the shift register to "do its thing". On the
rising edge of this input, the shift register shifts the data one location
over inside the register and enters the status of the data input into the
first bit. On each rising edge of this input the process will repeat.

• Reset : The reset input does just what it says. It clears all the bits inside
the register we're using to 0.

Shift Registers - Application :


• Imagine an ice-cream cone machine. We have 4 steps :

1. First we verify the cone is not broken.


2. Next we put ice cream inside the cone.(turn on output 500).
3. Next we add peanuts.(turn on output 501).
4. Finally we add sprinkles.(turn on output 502).

• If the cone is broken we obviously don't want to add ice cream and the
other items. Therefore we have to track the bad cone down our process
line so that we can tell the machine not to add each item.

• We use a sensor to look at the bottom of the cone (input 0000). If its on
then the cone is perfect and if its off then the cone is broken.

• An encoder tracks the cone going down the conveyor. (input 0001). A
push button on the machine will clear the register. (input 0002).

A good cone comes in front of the sensor (input 0000). The sensor (data
input) turns on. 1000 will not turn on until the rising edge of the encoder
(input 0001). Finally the encoder now generates a pulse and the status of
the data input (cone sensor input 0000) is transferred to bit 1000. The
register now looks like :

As the conveying system moves on, another cone comes in front of the
sensor. This time it's a broken cone and the sensor remains off. Now the
encoder generates another pulse. The old status of bit 1000 is transferred
to bit 1001. The old status of 1001 shifts to 1002. The old status of 1002
shifts to 1003. And the new status of the data input (cone sensor) is
transferred to bit 1000. The register now looks like :

Since the register shows that 1001 is now on, the ladder says that output
0500 will turn on and ice cream is put in the cone. As the conveying
system continues to move on, another cone comes in front of the sensor.
This time it's a good cone and the sensor turns on. Now the encoder
generates another pulse. The old status of bit 1000 is transferred to bit
1001. The old status of 1001 shifts to 1002. The old status of 1002 shifts
to 1003. And the new status of the data input (cone sensor) is transferred
to bit 1000. The register now looks like :
Since the register shows that 1002 is now on the ladder says that output
0501 will turn on and peanuts are put on the cone. Since 1001 now holds
the status of a broken cone, 500 remains off in the ladder above and no
ice-cream is inserted into this cone.

As the conveying system continues to move on, another cone comes in


front of the sensor. This time it's also a good cone and the sensor turns
on. Now the encoder generates another pulse.

- The old status of bit 1000 is transferred to bit 1001.


- The old status of 1001 shifts to 1002.
- The old status of 1002 shifts to 1003.
- And the new status of the data input(cone sensor) is transferred to bit
1000. The register now looks like :

• Since the register shows that 1003 is now on the ladder says that output
0502 will turn on and sprinkles are put on the cone.
• Since 1002 now holds the status of a broken cone, 501 remains off in
the ladder above and no peanuts are put onto this cone.

• Since the register shows that 1001 is now on the ladder says that output
0500 will turn on and ice cream is put in that cone.

As the conveying system continues to move on, another cone comes in


front of the sensor. This time it's another broken cone and the sensor
turns off. Now the encoder generates another pulse.

The old status of bit 1000 is transferred to bit 1001.


The old status of 1001 shifts to 1002.
The old status of 1002 shifts to 1003.
And the new status of the data input (cone sensor) is transferred to bit
1000.
The register now looks like :

As the conveying system continues to move on, another cone comes in


front of the sensor. This time it's another broken cone and the sensor
turns off. Now the encoder generates another pulse.

The old status of bit 1000 is transferred to bit 1001.


The old status of 1001 shifts to 1002.
The old status of 1002 shifts to 1003.
And the new status of the data input (cone sensor) is transferred to bit
1000.
The register now looks like :
Notice that the status of our first cone has
disappeared.

• The shift register is most commonly used in


conveyor systems, labeling or bottling applications,
etc

BOOLEAN LOGIC AND RELAY LOGIC


Since the relays in a machine perform some type of control operation, it can be said that they
perform a logical function. As with all logical functions, these control circuits must consist of
the fundamental AND, OR, and INVERT logical operations. Relay coils, N/C contacts, and
N/O contacts can be wired to perform these same fundamental logical functions. By properly
wiring relay contacts and coils together, we can create any logical function desired.
AND
Generally when introducing a class to logical operations, an instructor uses the analogy of a
series connection of two switches, a lamp and a battery to illustrate the AND function. Relay
logic allows this function to be represented this way. Figure 1-20 shows the actual wiring
connection for two switches, a lamp and a battery in an AND configuration. The lamp,
LAMP1, will illuminate only when SWITCH1 AND SWITCH2 are ON.

The Boolean expression for this is Lamp 1=(Switch 1 . Switch 2)


If we were to build this function using digital logic chips, the logic diagram for Equation 1-1
and Figure 1-20 would appears as shown in Figure 1-21. However, keep in mind that we will
not be doing this for machine controls.
To represent the circuit of Figure 1-21 in ladder logic form in an electrical machine diagram, we
would utilize the power from the rails and simply add the two switches (we have assumed these
are to be pushbutton switches) and lamp in series between the rails as shown in Figure 1-22.
This added circuit forms what is called a rung. The reason for the name “rung” is that as we
add more circuitry to the diagram, it will begin to resemble a ladder with two uprights and many
rungs.

OR
The same approach may be taken for the OR function. The circuit shown in Figure 1-23
illustrates two switches wired as an OR function controlling a lamp, LAMP2. As can be seen
from the circuit, the lamp will illuminate if SWITCH 1 OR SWITCH 2 is closed; that is,
depressing either of the switches will cause the lamp LAMP2 to illuminate.

The Boolean expression for this circuit is Lamp =(Switch1+ Switch 2)


For those more familiar with logic diagramming, the OR gate representation of the OR circuit in
Figure 1-23 and Equation 1-2 is shown in Figure 1-24. Again, when drawing machine
controls diagrams, we do not use this schematic representation.
We can now add this circuit to our ladder diagram as another rung as shown in Figure 1-25.
Note that since the switches SWITCH1 and SWITCH2 are the same ones used in the top rung,
they will have the same names and the same reference designators when drawn in rung 2. This
means that each of these two switches have two N/O contacts on the switch assembly. Some
designers prefer to place dashed lines between the two PB1 switches and another between the
two PB2 switches to clarify that they are operated by the same switch actuator (in this case the
actuator is a pushbutton) When we have two or more components in parallel in a rung, each
parallel path is called a branch. In our diagram in Figure 1-25, rung two has two branches, one
with PB1 and the other with PB2. It is possible to have branches on the load side of the rung
also. For example, we could place another lamp in parallel with LAMP2 thereby creating a
branch on the load side.

AND OR and OR AND


let us now complicate the circuitry somewhat. Suppose that we add two more switches to the
previous circuits and configure the original switch, battery and light circuit as in Figure 1-26
Notice that two switches have been added, SWITCH 3 and
SWITCH 4. For this system to operate properly, the LAMP
needs to light if SWITCH 1 AND SWITCH 2 are both on, OR
if SWITCH 3 AND SWITCH 4 are both on. This circuit is
called an AND-OR circuit.
The Boolean expression for this is illustrated in Equation 1-3.
Lamp 3=(Switch1. Switch2)+( Switch3. Switch 4)
The opposite of this circuit, called the OR-AND circuit is shown in Figure 1-27. For this
circuit, LAMP4 will be on whenever SWITCH1 OR SWITCH2, AND SWITCH3 OR
SWITCH4 are on. For circuits that are logically complicated, it sometimes helps to list all the
possible combinations of inputs (switches) that will energize a rung.

The Boolean expression for the OR-AND circuit


Lamp =(Switch1+ Switch 2 ) . (Switch 3+Switch 4)
These two rungs will now be added to our ladder diagram and are shown in Figure 1-28. Look
closely at the circuit and follow the possible power paths to energize LAMP3 and LAMP4.
You should see two possible paths for LAMP3:
SWITCH1 AND SWITCH2
SWITCH3 AND SWITCH4
Either of these paths will allow LAMP3 to energize. For LAMP4, you should see four
possible paths:
SWITCH1 AND SWITCH3
SWITCH1 AND SWITCH4
SWITCH2 AND SWITCH3
SWITCH2 AND SWITCH4. Any one of these four paths will energize LAMP4.

SEQUENCERS
A sequencer (SEQ) block is a powerful instruction that simulates a drum timer. A sequencer is
analogous to a music box mechanism, in which each peg produces a tone as the cylinder rotates
and strikes the resonators. In a sequencer, each peg (bit) can be interpreted as a logic 1 and no peg
as a logic 0. A sequencer table, which is similar to a spread-out music box cylinder, provides
sequencer information. Figure 9-111 illustrates a cylinder and sequencer table comparison. The
number of bits in a sequencer can vary from 8 to 64 or more. The width of the table may also vary,
as may the size of a cylinder. Through I/O registers, which map real output points, each step in a
sequencer table can become an output representing one of the pegs. Figure 9-112 shows a typical
sequencer functional block. An OFF-to-ON transition of the control input initiates this block,
causing the contents of the sequencer table to be output in a sequential manner. The pointer
register points to each step being output (i.e., the table register location). Every time the control
input is energized, the pointer register is automatically incremented, thus pointing to the next
table location. Depending on the PLC, either an event or time may drive the control input line;
therefore, sequencers may be either event driven or time driven. A reset pointer input can reset the
pointer register to zero (point to step 1), if needed. The sequence length and width specify how
many steps and bits are in the table, respectively. Whenever the sequencer instruction is enabled,
it energizes the block’s first output. The second output indicates the end of the sequencer table.
EXAMPLE 9-12
A PLC application calls for the implementation of ten different steps that take place in a
sequential manner. For the purpose of detecting a fault in a troubleshooting condition, the
process step code, as shown in Figure 9-113, should be revealed in a seven-segment display to
the operator. Implement an instruction block that will satisfy this application.

SOLUTION
Figure 9-114 shows a way to display the code number using a 16-bit register output connected
to a four-digit, seven-segment display. A sequencer instruction transfers the codes from the
sequencer table to the output register. The output register matches (i.e., is mapped to) the
location of the 16-bit output interface (i.e., rack 0, slot 7, corresponding to word 07). Every time
the Start of Process Step signal goes from OFF to ON, the sequencer will output the process
code to the indicator.

MASTER CONTROL RELAY


When large numbers of outputs have to be controlled, it is sometimes necessary for whole
sections of ladder diagrams to be turned on or off when certain criteria are realized. This could
be achieved by including the contacts of the same internal relay in each of the rungs so that its
operation affects all of them. An alternative is to use a master control relay.
With no input to input In 1, the output internal relay MC 1 is not energized, and so its contacts are
open. This means that all the rungs between where it is designated to operate and the rung on
which its reset MCR or another master control relay is located are switched off.

Assuming that it is designated to operate from its own rung, we can imagine it to be located in the
power line in the position shown, and so rungs 2 and 3 are off. When input In 1 contacts close, the
master relay MC 1 is energized. When this happens, all the rungs between it and the rung with its
reset MCR 1 are switched on. Thus outputs Out 1 and Out 2 cannot be switched on by inputs In 2
and In 3 until the master control relay has been switched on. The master control relay MC 1 acts
only over the region between the rung it is designated to operate from and the rung on which
MCR 1 is located. With a Mitsubishi PLC, an internal relay can be designated as a master control
relay by programming it accordingly. Thus to program an internal relay M100 to act as a master
control relay, the program instruction is:MC M100

Thus for the ladder diagram shown in Figure which is Figure with Mitsubishi addresses, the
program instructions are:
LD X400 OUT M100 MC M100 LD X401 OUT Y430 LD X402 OUT Y431 MC M100
ZONE CONTROL LAST STATE
A zone control last state (ZCL) instruction is similar to an MCR instruction— it determines
whether or not a group of ladder rungs will be evaluated. In this instruction, a ZCL output with
conditional inputs occurs at the start of the fenced zone, while an END ZCL output with no
conditional inputs occurs at the end of the zone. When the referenced ZCL output is activated, the
outputs within the zone are controlled by their respective input conditions. When the ZCL output
is turned OFF, the outputs within the zone stay in their last state.
the zone control last state (ZCL) instruction provides a similar function to the MCR. The
ZCL uses two output instructions to set up a barrier around a number of rungs that are
to be controlled. When the first ZCL rung is false, the zone control instruction freezes all
of the outputs inside the zone to their last state. This means that all outputs in the zone that are
on will remain energized, and all outputs in the zone that are off will remain dc-energized. One
function of using the ZCL instruction is to provide a means to use outputs more than once in a
program. This programming feature is especially useful where the program has multiple
functions such as a pallatizing system that can pack 4, 8, or 12 boxes per layer.

ARITHMETIC INSTRUCTIONS
Arithmetic instructions in a PLC include the basic four operations of addition, subtraction,
multiplication, and division. In addition to these four math functions, large PLCs may also
include square root operations. Table 9-7 lists these typical arithmetic instructions and their
symbols.
Like other instructions, arithmetic instructions may be in either the basic ladder format or the
functional block format; however, operation in either format is essentially the same. Figure 9-58
illustrates these formats. Most arithmetic instructions require three reference registers, which
define the two operand registers and the destination register of the operation. Some instructions,
such as multiplication and division, may use four registers. Most arithmetic operations in a PLC
require only single-precision arithmetic, meaning that the values of the operands and the result
can be held in one register each. If operations dealing with larger numbers are required, a PLC
may offer double-precision arithmetic instructions. Double precision means that the system
uses double the number of registers to hold the operands and result, because it must store larger
numbers. For example, a double-precision addition instruction would use a total of six registers,
two for each operand and two for the result.
As discussed earlier, a register can hold a maximum value of 65,535 in 16 bits (all 1s) if there is
no sign bit. If the most significant bit is used as the sign bit, then a register may hold a maximum
value of +32,767 and a minimum value of –37,767. If the result value of the operation is larger
than the value a register can hold, an overflow condition will exist, and the instruction will turn
ON an overflow bit or output. The numerical format used in math operations will vary depending
on the PLC but is usually three, four, or five
digits (BCD or binary). Note that in single-precision BCD, the maximum register value is 9999
(unsigned) or ±999 (signed). In the following discussion, we will present arithmetic instructions
in both ladder and block formats to familiarize you with the differences between them. Note that
the ladder format may require other ladder data transfer
instructions to obtain the arithmetic operands. In functional block format, some manufacturers
offer the ability to “cascade” block functions (see Figure
9-59). Cascading is very useful when dealing with multiple arithmetic operations, since one
instruction will activate the next one when finished. Other manufacturers allow arithmetic
operations to be performed in block form (see Figure 9-60); that is, using blocks of several
contiguous registers as the operands and storing the results in another block of registers.

You might also like