0% found this document useful (0 votes)
72 views63 pages

CHAPTER 4 Intermediate PLC Functions

Uploaded by

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

CHAPTER 4 Intermediate PLC Functions

Uploaded by

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

Unit -4

Intermediate PLC Functions

1
Content :

o Jump,
o Subroutine,
o Timers- On delay, Off delay, Pulse timer, Retentive timer,
o Counters- Up counter, down counter,
o PLC arithmetic functions,
o PLC number comparison functions,
o Motor controls- DOL starter, Star delta starter,
Autotransformer starter, stepper motor control,
o Conveyer system
o (Ladder programs based on advanced instructions)
Jump

● A function often provided with PLCs is the conditional


jump.
● We can describe this as:

IF
(some condition occurs)

THEN
perform some instructions

ELSE
perform some other instructions
Continue…

● Such a facility enables programs to be designed such


that –

if certain conditions are met then certain events occur,

if they are not met then other events occur

● for example, we might need to design a system so that


if the temperature is above 60o C a fan is switched on,
and if below that temperature no action occurs.

● If program scan cycle is to be skipped then also jump


Continue…

● When there is an input to In 1, its contacts


close and there is an output to the jump
relay.
● This then results in the program jumping to
the rung-4 in which the jump end occurs, so
missing out intermediate program rungs.
● Thus, in this case, when there is an input to
Input 1, the program jumps to rung 4 and
then proceeds with rungs 5, 6, etc.
● When there is no input to Input 1, the jump
relay is not energised and the program then
proceeds to rungs 2, 3, etc
Continue..

● The jump instruction is denoted by CJP (conditional


jump) and the place to which the jump occurs is
denoted by EJP (end of jump). This form used by
Mitsubishi

● With the Allen-Bradley PLC-5 format the jump takes


place from the jump instruction (JMP) to the label
instruction (LBL).
● The JMP instruction is given a three-digit number from
000 to 255 and the LBL instruction the same number
Jumps within jumps

● Jumps within jumps are possible. For


example, we might have the situation
shown in Figure.
● If the condition for the jump instruction 1 is
realised then the program jumps to rung 8.
● If the condition is not met then the
program continues to rung 2 and then rung
3.
● If the condition for the jump instruction 2 is
realised (i.e. In 3 High) then the program
jumps to rung 6.
Subroutines

● Subroutines are small programs to


perform specific tasks which can be
called for use in larger programs.

● When input 1 occurs, the subroutine P is


called. This is then executed, the
instruction SRET indicating its end and
the point at which the program returns to
the main program. To clearly indicate
where the main program ends the FEND
instruction is used.
Continue…

● With Allen-Bradley, subroutines


are called by using a jump-to
subroutine JSR instruction, the
start of the subroutine being
indicated by SBR and its end
and point of return to the main
program by RET
Continue…

● With Siemens a similar format


can be adopted, using CALL to
call up a subroutine block and
RET to indicate the return
instruction to the main
program

● However, a function box


approach can be used .
● There is a library of subroutine
functions to be called.
Subroutine example

Main Program
Subroutine
program
Timers

● In many control tasks there is a need to control time.


● For example, a motor or a pump might need to be
controlled to operate for a particular interval of time, or
perhaps be switched on after some time interval.
● PLCs thus have timers as built-in devices.
● Timers count fractions of seconds or seconds using the
internal CPU clock
● A common approach is to consider timers to behave
like relays with coils which when energised result in
the closure or opening of contacts after some preset
time.
● The timer is thus treated as an output for a rung.
Continue…

● There are a number of different forms of


timers that can be found with PLCs.
● With small PLCs there is likely to be just
one form, the on-delay timers. - These are
timers which turn on after a particular time
delay .
● Off-delay timers are on for a fixed period of
time before turning off .
● Another type of timer that occurs is the
pulse timer.- This timer switches on or off
for a fixed period of time.
Standard symbols for timers
Continue…

● The time duration for which a timer has been set is


termed the preset and is set in multiples of the time
base used.
● Some time bases are typically 10 ms, 100 ms, 1 s, 10 s
and 100 s.
● Thus a preset value of 5 with a time base of 100 ms is
a time of 500 ms.
Pulse timers

● Pulse timers are used to produce a fixed duration


output from some initiating input.
Retentive timer

● Retentive timer is a timer which retains the accumulated


value in case of power loss, change of processor mode or
rung state going from true to false (rung state transition).
● Retentive timer can be used to track the running time.
● Retentive timer can be used to track the running time of a
motor for its maintenance purpose. Each time the motor is
turned off, the timer will remember the motor’s elapsed
running time.
● The next time the motor is turned on, the time will
incremented from there. This timer can be reset by using a
reset instruction.
of a motor for its maintenance purpose.
Cascaded timers
● Timers can be linked together, the term cascaded is
used, to give longer delay times than are possible with
just one timer.

● Example : we have timer 1 with a delay time of 999 s.


This timer is started when there is an input to In 1.
When the 999 s time is up, the contacts for timer 1
close. This then starts timer 2.
● This has a delay of 100 s. When this time is up, the
timer 2 contacts close and there is an output from Out
1.
● Thus the output occurs 1099 s after the input to In 1
Cascaded timers- example
On-off cycle timer

● on-delay timers can be used to produce an on-off cycle timer


● The timer is designed to switch on an output for 5 s, then off for 5
s, then on for 5 s, then off for 5 s, and so on.
● When there is an input to In 1 and its contacts close, timer 1
starts. Timer 1 is set for a delay of 5 s. After 5 s, it switches on
timer 2 and the output Out 1. Timer 2 has a delay of 5 s. After 5 s,
the contacts for timer 2, which are normally closed, open. This
results in timer 1, in the first rung, being switched off. This then
causes its contacts in the second rung to open and switch off timer
2. This results in the timer 2 contacts resuming their normally
closed state and so the input to In 1 causes the cycle to start all
over again.
Continue….
Timers Programmes
● Enabling the indicator to be ON after a 5 sec delay and
OFF after a 3 sec delay by the switch.
Star delta starter
Stepper motor
with four coils –
delay 3 sec
Counters

● Counters are provided as built-in elements in PLCs and


allow the number of occurrences of input signals to be
counted.

● E.g. This might be where items have to be counted as


they pass along a conveyor belt,

● or the number of revolutions of a shaft,

● Or the number of people passing through a door.


Forms of counter

● A counter is set to some preset number value and,


when this value of input pulses has been received, it
will operate its contacts. Thus normally open contacts
would be closed, normally closed contacts opened.

● There are two types of counter, though PLCs may not


include both types.
● These are down-counters and up-counters.
Continue…
Down-counters

● Down-counters count down from the preset value to


zero, i.e. events are subtracted from the set value.
● When the counter reaches the zero value, its contacts
change state.
● Most PLCs offer down counting.
Up-counters

● Up-counters count from zero up to the preset value, i.e.


events are added until the number reaches the preset
value.
● When the counter reaches the set value, its contacts
change state.
Basic counting circuit

● When there is a pulse input to In 1,


the counter is reset.
● When there is an pulse input to In 2,
the counter starts counting.
● If the counter is set for, say, 10
pulses, then when 10 pulse inputs
have been received at In 2, the
counter’s contacts will close and there
will be an output from Out 1.
● If at any time during the counting
there is an input to In 1, the counter
will be reset and start all over again
and count for 10 pulses.
Counter applications- Conveyer belt

● Consider the problem of items passing along a


conveyor belt, the passage of an item crosses a
particular point being registered by a light beam to a
photoelectric cell being interrupted, and after a set
number there is to be a signal sent informing that the
set count has been reached and the conveyor stopped.
Packaging

● Consider the problem of the control of a


machine which is required to direct 6 tins
along one path for packaging in a box and
then 12 tins along another path for
packaging in another box.
● A deflector plate might be controlled by a
photocell sensor which gives an output
every time a tin passes it. Thus the
number of pulses from the sensor has to
be counted and used to control the
deflector.
● Output low indicate deflector in one
Up and down counting

● It is possible to program up- and down-counters together. Consider


the task of counting products as they enter a conveyor line and as
they leave it, or perhaps cars as they enter a multi-storage parking lot
and as they leave it.
● An output is to be triggered if the number of items/cars entering is
some number greater than the number leaving, i.e. the number in the
parking lot has reached a ‘saturation’ value.
● The output might be to illuminate a ‘No empty spaces’ sign. Suppose
we use the up-counter for items entering and the count down for
items leaving.
continue…

● Up-down counters are available as single


entities. Figure shows the IEC 1131-3 standard
symbol. The counter has two inputs CU and CD
and counts up the number of pulses detected
at the input CU and counts down the number of
pulses detected at input CD. If the counter
input reaches zero, the QD output is set on and
the counting down stops. If the count reaches
the maximum value PV, the QU output is set on
and the counting up stops. CV is the count
value. LD can be used to preset the counter
output CV with the value PV. The reset R clears
Required instructions in Delta PLC

● DCNT =Up-down counter


● M1200 = actuates Down counting
Timers with counters

● A typical timer can count up to 16 binary bits of data.


● Thus, if we have a time base of 1 s then the maximum
time that can be dealt with by a timer is just over 546
minutes or 9.1 hours.
● If the time base is to be 0.1 s then the maximum time
is 54.6 minutes or just short of an hour.
● By combining a timer with a counter, longer times can
be counted.
Continue…
● If the timer has a time base of 1 s and a preset value
of 3600, then it can count for up to 1 hour.
● When input I:012/01 is activated, the timer starts to
time in one second increments. When the time
reaches the preset value of 1 hour, the DN bit is set
to 1 and the counter increments by 1.
● The DN bit setting to 1 also reset the timer and the
timer starts to time again. When it next reaches its
preset time of 1 hour, the DN bit is again set to 1 and
the counter increments by 1.
● With the counter set to a preset value of 24, the
counter DN bit is set to 1 when the count reaches 24
and the output O:013/01 is turned on.
● We thus have a timer which is able to count the
seconds for the duration of a day and would be able
to switch on some device after 24 hours.
Similar concept in Delta PLC
PLC arithmetic functions

● Some PLCs are equipped to carry out just the arithmetic operations
of addition and subtraction, others the four basic arithmetic
operations of addition, subtraction, multiplication and division,
while others can carry out these and various other functions such
as the exponential.
● Addition and subtraction operations are used to alter the value of
data held in data registers.
● For example, this might be to adjust a sensor input reading or
perhaps obtain a value by subtracting two sensor values or alter
the preset values used by timers and counters.
● Multiplication might be used to multiply some input before perhaps
adding to or subtracting it from another.
Continue…

● The way in which PLCs have to


be programmed to carry out
such operations varies.
● Allen-Bradley in some of their
PLCs use a compute (CPT)
instruction.
● This is an output instruction
that performs the operations
defined and then writes the
results to a specified
destination address.
Continue…

● Basic form of the Siemens


instructions for arithmetic
functions
● With integers the functions
available are ADD_1 for
addition, SUB_1 for subtraction,
MUL_1 for multiplication and
DIV_1 for division with the
quotient as the result.
● The arithmetic functions are
executed of there is a 1 at the
enable EN input.
PLC number comparison functions
● The data comparison instruction gets the PLC to compare two data values.
● Thus it might be to compare a digital value read from some input device
with a second value contained in a register.
● For example, we might want some action to be initiated when the input from
a temperature sensor gives a digital value which is less than a set value
stored in a data register in the PLC.
● PLCs generally can make comparisons for –
○ less than (< or LT or LES),

○ equal to (= or = = or EQ or EQU),

○ less than or equal to (≤ or <= or LE or LEQ),

○ greater than (> or GT or GRT),

○ greater than or equal to (≥ or >= or GE or GEQ) and

○ not equal to (≠ or <> or NE or NEQ).


Equal to
● Use the EQU instruction to test whether two values are
equal. If source A and source B are equal, the instruction is
logically true.
● If these values are not equal, the instruction is logically false.
Source A must be an actual value from any address. Source
B can either be a program constant or a address.
● Negative integers are stored in two’s complement form.
Not Equal to
● Use the NEQ instruction to test whether two values are not
equal.
● If source A and source B are not equal, the instruction is
logically true.
● If the two values are equal, the instruction is logically false.
● Source A must be an address. Source B can be either a
program constant or an address.
● Negative integers are stored in two’s complement form.
Less Than (LES)
● Use the LES instruction to test whether one value (source A) is less
than another (source B).
● If source A is less than the value at source B, the instruction is logically
true.
● If the value at source A is greater than or equal to the value at source
B, the instruction is logically false.
● Source A must be an address. Source B can either be a program
constant or an address. Negative integers are stored in two’s
complement form.
Less Than or Equal (LEQ)
● Use the LEQ instruction to test whether one value (source A) is less
than or equal to another (source B).
● If the value at source A is less than or equal to the value at source B,
the instruction is logically true.
● If the value at source A is greater than the value at source B, the
instruction is logically false. Source A must be an address.
● Source B can either be a program constant or an address.
● Negative integers are stored in two’s complement form.
Greater Than (GRT)
● Use the GRT instruction to test whether one value (source A) is greater
than another (source B).
● If the value at source A is greater than the value at source B, the
instruction is logically true.
● If the value at source A is less than or equal to the value at source B,
the instruction is logically false.
● Source A must be an address. Source B can either be a program
constant or an address. Negative integers are stored in two’s
complement form.
Greater Than or Equal (GEQ)
● Use the GEQ instruction to test whether one value (source A) is greater
than or equal to another (source B).
● If the value at source A is greater than or equal to the value at source
B, the instruction is logically true.
● If the value at source A is less than the value at source B, the
instruction is logically false. Source A must be an address. Source B
can either be a program constant or an address. Negative integers are
stored in two’s complement form.
Comparison instruction in delta plc

Input data Number for


comparison
Ladder programs based on advanced instructions

● DOL Starter
● Star Delta Starter
● Stepper motor control
● Autotransformer starter
● Conveyer control
DOL Starter
Star Delta Starter
Autotransformer Starter
Stepper motor control
Conveyer control

You might also like