Sie sind auf Seite 1von 55

Topic 3_2

PLC Programming

Dr. Mahesh S. Narkhede


Electrical Engineering Department
Government Polytechnic, Mumbai
msnarkhede@ymail.com
https://drmaheshsnarkhede.wordpress.com/
Course Outcome
After studying this topic you will be able to
• Classify PLC Instructions into Bit , Logical,
Comparison, Timer, Counter, Scaling type
• Develop Industrial process examples like - Bottle
filling plant, Starting of an Induction Motor with
forward and reverse control, Traffic light control
using PLC

2
Classification of PLC Instructions
• Each symbol in ladder logic is an instruction.
The Ladder Logic instructions are classified
below along with some examples.
• Bit type instructions- XIC, XIO, OTE, OTL, OUT,
OSR.
• Logical instructions- OR, AND, NOT, XOR.
• Comparison instructions- EQU, NEQ, LES, LEQ,
GRT, GERQ, LIM.
• Timer instructions- TON, TOFF, RTO.
• Counter instructions- CTU, CTD.
• Scaling instructions- SCP.
3
Classification of PLC Instructions
Bit type instructions
• These instructions regulate and control the
status of bits in a data table, such as input bits or
bit words for timer controls

4
Bit type PLC Instructions
XIC Examine if Closed

• Examines a bit for an On condition


• Use the XIC instruction in your ladder logic to
determine if a bit is ON.
• 0 = False
• 1 = True
• Devices : Start/Stop push buttons, Selectors,
Limit switch ,Proximity switch ,Light ,Internal bit
5
Bit type PLC Instructions
XIO Examine if Open

• Examines a bit for an off condition.


• Use an XIO instruction in your ladder logic to
determine if a bit if off.
• 1 = True
• 0 = False
• Devices : Start/Stop push buttons, Selectors ,
Limit switch, ,Proximity switch ,Light ,Internal bit
6
Bit type PLC Instructions
OTE Output Energize

• Turns a bit on or off


• Use OTE instruction in your ladder logic to turn
on a bit when rung condition is evaluated as
true.
• Devices : Light ,Motor run signal ,Internal bits

7
Bit type PLC Instructions
OTL Output Latch

• Turns a bit on when the rung is executed,


and this bit retains its state when the rung is
not executed or a power cycle power occurs.
• When you assign an address to the OTL
instruction that corresponds to the address of a
physical output, the output device wired to the
screw terminal is energized when the bit is set.
When rung conditions become false, the bit
remains set and the corresponding output
8
device remains energized.
Bit type PLC Instructions
• Actuating the latch input turns the function on or
causes it to change state. The function then
stays on even if the latch input is turned off. To
turn the function off, another input must unlatch
which turns the function off.
• Usually we latch a signal with a condition and
then unlatch it when a different condition
becomes true. Most of time the Latch / Unlatch
go together.

9
Bit type PLC Instructions
OTU Output Unlatch

• Turns a bit off when the rung is executed,


and this bit retains its state when the rung is
not executed or when power cycle occurs.
• OTU is a retentive output instruction. OTU can
only turn off a bit. This instruction is usually used
with OTL with both OTL and OTU addressing
the same bit.
• Ladder logic can examine a bit controlled by
OTU as often as necessary. 10
Bit type PLC Instructions
• When you assign an address to the OTU
instruction that corresponds to the address of a
physical output, the output device wired to the
screw terminal is de-energized when the bit is
cleared.
• The unlatch instruction tells the controller to turn
off the addressed bit. Thereafter, the bit remains
off, regardless of the rung condition, until it is
turned on.

11
Bit type PLC Instructions
OSR One-Shot Rising

• Triggers a one-time event.


• The OSR instruction is a retentive input
instruction that triggers an event to occur only
one time. Use the OSR instruction when an
event must start based on change of state of the
rung from false to true.

12
Logical Instructions
OR

• It is equivalent to a OR gate which is


associated with the following symbol that also
can have any number of inputs but only one
output.

13
Logical Instructions
AND

• It is equivalent to a AND gate which is


associated with the following symbol that can
have any number of inputs but only one
output.

14
Logical Instructions
NOT

• It is equivalent to a NOT gate which is


associated with the following symbol that can
have one input and only one output.

15
Logical Instructions
XOR

• It is equivalent to a XOR gate which is


associated with the following symbol that can
have output if either one of the inputs are on.

16
Comparison Instructions
EQU - Equal

• Test whether two values are equal or not.


• If source A and Source B are equal, the
instruction is logically true. Source A must be
an address. Source B can either be a
program constant or an address.

17
Comparison Instructions
NEQ – Not Equal

• Test whether one value is not equal to a


second value.
• 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.
18
Comparison Instructions
LES – Less Than

• Test whether one value is less than a second


value.
• 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. 19
Comparison Instructions
LEQ – Less Than or Equal

• Test whether one value is less than or equal


to a second value.
• If value at source A is less than or equal to the
value at source B, the instruction is logically true
else it is false.
• Source A must be an address. Source B can
either be a program constant or an address.
20
Comparison Instructions
GRT – Greater Than

• Test whether one value is greater than the


second value.
• If the value at source A is greater than the value
at source B, the instruction is logically true else it
is false.
• Source A must be an address. Source B can
either be a program constant or an address
21
Comparison Instructions
GEQ – Greater or Equal

• Test whether one value is greater or equal to


a second value.
• If the value at source A is greater than or equal
the value at source B, the instruction is logically
true else it is false.
• Source A must be an address. Source B can
either be a program constant or an address.
22
Comparison Instructions
LIM – Limit Test

• Test whether one value is within the limit


range of two other values
• The Low limit, Test, and High Limit values can
be word addresses or constants, restricted to the
combinations shown on next slide:

23
Comparison Instructions
• If the Test parameter is a program constant,
both the Low Limit and High Limit parameters
must be word addresses.
• If the Test parameter is a word address, the Low
Limit and High Limit parameters can be either a
program constant or a word address.

24
Timer Instructions
TON – Timer On Delay

• Count time base intervals when the instruction


is true.
• The Timer On Delay instruction begins to count
time base intervals when rung conditions become
true. As long as rung conditions remain true, the
timer adjust its accumulated value (ACC) until it
reaches the preset value (PRE).
• The accumulated value is reset when rung
conditions go false. 25
Timer Instructions
• Each Timer on Delay is made of a 3-word
element.
• Word 1 is the control word
• Bit 0-12: Internal Use
• Bit 13: Done (DN) this bit is on when the
Accumulation value >= Preset Value
• Bit 14: Timer Timing (TT) this bit is on when the
timer is timing
• Bit 15: Enabled (EN), this bit is on when the
timer is energized.

26
Timer Instructions
• Word 2 stores the preset value. (PRE)
• The programmer specifies this value. When the
accumulated time reaches the preset value the
controller sets the done bit. When the
accumulated value becomes equal to or greater
than the preset value, the done bit is set. Usually
preset value is from 0 - 32,767
• If a timer-preset value is negative an error will
occur.

27
Timer Instructions
• Word 3 stores the accumulated value. (ACC)
• This is the time elapsed since the timer was last
reset. When enabled the timer updates this
continually.
• Time Base: is the timing update interval, this can
vary from 0 - 1 second.

28
Timer Instructions
TOF – Timer Of Delay

• Counts time base intervals when the


instruction is false.
• The Timer Off Delay instruction begins to count
time base intervals when the rung makes a true to
false transition. As long as rung conditions remain
false, the timer increments its accumulated value
(ACC each scans until it reaches the preset value
(PRE).
29
Timer Instructions
• The accumulated value is reset when rung
conditions go true regardless of whether the timer
has timed out.
• Each timer address is made of a 3-word
element.
• Word 1 is the control word
• Bit 0-12: Internal Use
• Bit 13: DN- Done
• Bit 14: TT - Timer Timing
• Bit 15: EN - Timer is enabled

30
Timer Instructions
• Word 2 stores the preset value. (PRE)
• Specifies the value, which the timer must reach
before the controller sets the done bit. When the
accumulated value becomes equal to or greater
than the preset value, the done bit is se.
• Preset value is from 0 - 32,767
• Word 3 stores the accumulated value. (ACC)
• This is the time elapsed since the timer was last
reset. When enabled the timer updates this
continually.
• Time Base: is the timing update interval, this can
vary from 0 - 1 second.
31
Timer Instructions
RTO – Retentive Timer

• Counts time base intervals when the


instruction is true and retains the accumulated
value when the instruction goes false or when
power cycle occurs.
• The Retentive Timer instruction is a retentive
instruction that begins to count time base intervals
when rung conditions become true.
32
Timer Instructions
• The Retentive Timer instruction retains its
accumulated value when any of the following
occurs:
• Rung conditions become false.
• Changing Processor mode from REM run /Test /
program mode.
• The processor loses power while battery back up is
still maintained and a fault occurs.
• Note: To reset the accumulated value in RTO, you
must use a reset instruction (RES) with the same
address.

33
Timer Instructions
• Each Retentive Timer is made of a 3-word
element.
• Word 1 is the control word
• Bit 0-12: Internal Use
• Bit 13: DN- Done
• Bit 14: TT - Timer Timing
• Bit 15: EN - Timer is enabled

34
Timer Instructions
• Word 2 stores the preset value. (PRE)
• Specifies the value, which the timer must reach
before the controller sets the done bit. When the
accumulated value becomes equal to or greater
than the preset value, the done bit is se.
• Preset value is from 0 - 32,767
• Word 3 stores the accumulated value. (ACC)
• This is the time elapsed since the timer was last
reset. When enabled the timer updates this
continually.
• Time Base: is the timing update interval, this can
vary from 0 - 1 second.
35
Counter Instructions
CTU – Count Up

• Increments the accumulated value at each false


to true transition and retains the accumulated
value when the instruction goes false or when
power cycle occurs.
• The CTU is an instruction that counts false to true
transition. When this transition happens the
accumulated value is incremented by one count.
• A CTU accumulation is reset by the RES
instruction. 36
Counter Instructions
• If the accumulation value is over the maximum
range then the overflow (OV) bit will be true.
• Each counter address is made of a 3-word
element.
• Word 1 is the control word
• Bit 0-7: Internal Use
• Bit 10: UA - Update accumulation value.
• Bit 11: UN - Underflow bit.
• Bit 12: OV - Overflow bit.
• Bit 13: DN - Done
• Bit 14: CD - Count down is enabled.
• Bit 15: CU - Count up is enabled. 37
Counter Instructions
• Word 2 stores the preset value. (PRE)
• Specifies the value, which the counter must reach
before the controller sets the done bit. When the
accumulator value becomes equal to or greater
than the preset value, the done status bit is set.
You can use this bit to control an output device.
• Preset value is from -32,768 to 32,767
• If a timer-preset value is negative an error will
occur.
• Word 3 stores the accumulated value. (ACC)
• This is the number of times of false to true
transitions that have occurred since the counter
was last rest. 38
Counter Instructions
CTD – Count Down

• Decrements the accumulate value at each false


to true transition and retains the accumulated
value when the instruction goes false or when
power cycle occurs.
• The CTD is an instruction that counts false to true
transition. When this transition happen the
accumulated value is decrements by one count.
• A CTD accumulation is reset by the RES
instruction. 39
Counter Instructions
• If the accumulation value is below the minimum
range then the underflow (UN) bit will be true.
• Each counter address is made of a 3-word
element.
• Word 1 is the control word
• Bit 0-7: Internal Use
• Bit 10: UA - Update accumulation value.
• Bit 11: UN - Underflow bit.
• Bit 12: OV - Overflow bit.
• Bit 13: DN - Done
• Bit 14: CD - Count down is enabled.
• Bit 15: CU - Count up is enabled. 40
Counter Instructions
• Word 2 stores the preset value. (PRE)
• Specifies the value, which the counter must reach
before the controller sets the done bit. When the
accumulator value becomes equal to or greater
than the preset value, the done status bit is set.
You can use this bit to control an output device.
• Preset value is from -32,768 to 32,767
• If a timer-preset value is negative an error will
occur.
• Word 3 stores the accumulated value. (ACC)

41
Scaling Instruction
SCP – Scale with parameters

• Produces a scaled output value that has a


linear relationship between the input and
scaled values. The scaled result is returned to the
address indicated by the output parameter.

42
Bottle Filling Plant

43
Bottle Filling Plant

44
Bottle Filling Plant
• Once the start button is pressed the green light (L1)
turns ON and remains ON until stop button is
pressed. As light turns ON out feed motor(M2)
starts running. After M2 runs and if either limit
switch(LS) has not signalled or filled bottle condition
is fulfilled motor(M1) starts. After limit switch has
signalled timer,T1 gets activated. After T1 gives
done (DN)signal and photo detector (PE) is
disabled ,solenoid valve gets in operation. As PE
signals solenoid stops and buzzer(B1) sounds after
which timer,T2 gets enabled which stops the
process for 0.7 seconds. Once the filled bottle
condition is activated the cycle starts again.
45
Traffic Light Control

RED
GREEN
YELLOW

RED
GREEN
YELLOW

46
Traffic Light Control
Logic:
• Press Start Push Button to start the function.
• Red lamp should be ON for 25 seconds.
• After 25 seconds Red lamp should be OFF. Then
Green lamp should be ON for 35 seconds.
• After 35 seconds Green lamp should be OFF. Now
Yellow lamp should be ON for 15 seconds.
• After 15 seconds Yellow lamp should be OFF.
Again Red lamp should be made ON for next 25
seconds.
• Repeat the cycle from step 2, to autostart.
• Press Stop Push Button to stop the function.
47
Traffic Light Control

48
Starting of an Induction Motor with
Forward and Reverse control

49
Starting of an Induction Motor with
Forward and Reverse control

50
Starting of an Induction Motor with
Forward and Reverse control

51
Starting of an Induction Motor with
Forward and Reverse control

52
Here Time delay is provided by timers TD1 and TD2
53
References
• https://realpars.com/plc-programming-
languages/
• https://automationforum.in

54
HAPPY LEARNING!
Dr.Mahesh S. Narkhede
Electrical Engineering Department
Government Polytechnic, Mumbai
msnarkhede@ymail.com
https://drmaheshsnarkhede.wordpress.com/ 55

Das könnte Ihnen auch gefallen