0% found this document useful (0 votes)
38 views108 pages

UNIT4

The document outlines a syllabus for a Mechatronics course, covering topics such as the introduction to Mechatronics, microprocessors and microcontrollers, programmable peripheral interfaces, programmable logic controllers (PLCs), and actuators. It includes detailed descriptions of PLC architecture, programming, ladder logic, and various control processes. Additionally, it lists textbooks and references for further reading on the subject.

Uploaded by

saravanan
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)
38 views108 pages

UNIT4

The document outlines a syllabus for a Mechatronics course, covering topics such as the introduction to Mechatronics, microprocessors and microcontrollers, programmable peripheral interfaces, programmable logic controllers (PLCs), and actuators. It includes detailed descriptions of PLC architecture, programming, ladder logic, and various control processes. Additionally, it lists textbooks and references for further reading on the subject.

Uploaded by

saravanan
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/ 108

Syllabus

UNIT I INTRODUCTION 9
Introduction to Mechatronics – Systems – Concepts of Mechatronics
approach – Need for Mechatronics – Emerging areas of Mechatronics – Classification
of Mechatronics. Sensors and Transducers: Static and dynamic Characteristics of
Sensor, Potentiometers – LVDT – Capacitance sensors – Strain gauges – Eddy current
sensor – Hall effect sensor – Temperature sensors – Light sensors
UNIT II MICROPROCESSOR AND MICROCONTROLLER 9
Introduction – Architecture of 8085 – Pin Configuration – Addressing Modes
–Instruction set, Timing diagram of 8085 – Concepts of 8051 microcontroller – Block
diagram,.
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE 9
Introduction – Architecture of 8255, Keyboard interfacing, LED display –
interfacing, ADC and DAC interface, Temperature Control – Stepper Motor Control –
Traffic Control interface.
UNIT IV PROGRAMMABLE LOGIC CONTROLLER 9
Introduction – Basic structure – Input and output processing –
Programming – Mnemonics – Timers, counters and internal relays – Data handling –
Selection of PLC.
UNIT V ACTUATORS AND MECHATRONIC SYSTEM DESIGN 9
Types of Stepper and Servo motors – Construction – Working Principle –
Advantages and Disadvantages. Design process-stages of design process – Traditional
and Mechatronics design concepts – Case studies of Mechatronics systems – Pick
and place Robot – Engine Management system – Automatic car park barrier.
1
Text Books and References
TEXT BOOKS:

1. Bolton, “Mechatronics”, Prentice Hall, 2008


2. Ramesh S Gaonkar, “Microprocessor Architecture, Programming, and
Applications with the 8085”, 5th Edition, Prentice Hall, 2008.

REFERENCES:

1. Bradley D.A, Dawson D, Buru N.C and Loader A.J, “Mechatronics”,


Chapman and Hall, 1993.
2. Clarence W, de Silva, "Mechatronics" CRC Press, First Indian Re-print,
2013
3. Devadas Shetty and Richard A. Kolk, “Mechatronics Systems Design”,
PWS publishing company, 2007.
4. Krishna Kant, “Microprocessors & Microcontrollers”, Prentice Hall of
India, 2007.
5. Michael B.Histand and Davis G.Alciatore, “Introduction to Mechatronics
and Measurement systems”, McGraw Hill International edition, 2007.

2
Unit – 4
Programmable Logic Controller (PLC)

Introduction – Basic structure – Input and output

processing – Programming – Mnemonics – Timers, counters and

internal relays – Data handling – Selection of PLC

3
PLC

4
Introduction
Programmable Logic Controller

• PLC: Basically a controller.

• Controller: Controls the parameters of the system that affects the system

performance. (e.g. car)

• Logical controller: controls the parameters with certain logic. (e.g. Lift)

• Programmable: Can be reprogrammed for different tasks by end user


Introduction
Programmable Logic Controller

• Microprocessor-based controller, uses programmable memory to store

instructions to implement functions like, logic, sequence, timing, etc. to control

parameters of the system for effectiveness.

• Can be reprogrammed for different tasks by end user.


Programmable Logic Controller

Reasons why PLCs are being widely used

• Rugged and designed to withstand vibrations, temperature, humidity and noise

• User friendly, fast and easy to operate

• Eliminate the need for hard wired relay logic

• Automation in industries (Assembly, Bottling plant, Welding, Painting, MHE etc.)

• Its input and output modules can be extended depending on the requirements
Basic Structure
Programmable Logic Controller
Basic Structure

Logic

Solenoid valve
Motors
Sensors & Transducers Actuators
LED display
Sounds / Alarm
Programmable Logic
Basic Structure
Controller
1. Power supply

2. Central processing unit (CPU)

3. Storage / Memory

4. Input/output interface circuit

5. The function module

6. The communication module

7. Programming unit
Programmable
Logic Controller
CPU

• Control centre of the PLC

• Performs the routine check

• It controls and processes all the operations within the PLC


Programmable
Logic Controller
Memory: The memory elements available in PLC are;

• ROM: Permanent storage for the OS and fixed data.

• RAM: For user's program.

• Programs in RAM can be changed by the user.

• To prevent the loss of these programs, when the supply is switched off, a

battery is provided in the PLC to maintain the RAM contents for a period of time.
Programmable
Logic Controller
lnput / Output (l/O) circuitry

I/O unit provides the interface between the system and outside world.

Programs are entered into using the input unit.

The programs, can also be entered by means of PC, with an appropriate software

package.
Ladder Logic / Ladder
Program
• Basic form of programming with PLCs is a ladder programming.

• This involves each program task being specified as a rung of a ladder.


Ladder diagram / Logic
• Ladder diagram: Programming language for PLCs.

• Ladder diagram (LD): official name given in the international PLC programming

standard IEC-61131.

• Symbols represent opening and closing relays, counters, timers, shift registers,

etc.

• Symbols are arranged in the desired program routine.

• Rules in ladder logic are termed “rungs.”

• Each rung has a single output.


The Logic Behind The Ladder

There are seven basic parts of a ladder diagram.

1. Rails: Two rails (power rails) in a ladder diagram, represented by vertical lines.

• The power flows from the left hand side to the right hand side.

2. Rungs: Horizontal lines, connects the rails to the logic expressions.


The Logic Behind The Ladder

3. Inputs: Inputs are external control actions (Sensors and Transducers).

E.g. Push button being pressed, limit switch being triggered.

• Inputs are hardwired to the PLC terminals.

• Represented in the ladder diagram by a normally open (NO) or normally closed

(NC) contact symbol.


The Logic Behind The Ladder

4. Outputs: Outputs are external devices (Actuators).

E.g. Turn on and off an electric motor or a solenoid valve.

• The outputs are hardwired to the PLC terminals.

• Represented in the ladder diagram by a relay coil symbol.


The Logic Behind The Ladder

5. Logic Expressions: The logic expressions are used in combination with the

inputs and outputs to formulate the desired control operations.

6.Address Notation: Address notation describes the input, output, logic expression,

memory addressing structure of the PLC.

• Tag names: descriptions allocated to the addresses.


The Logic Behind The Ladder

7. Comments:

• Important part of a ladder diagram.

• Comments are displayed at the start of each rung.

• Used to describe the logical expressions and control operations that the rung.

• Understanding ladder diagrams are easier by using comments.


22
How to Read Ladder Logic
Microprocessors operates on the binary concept.

‘Binary’: principle, is that the event/s can be thought of in one of two states.
The states can be defined as:

• 1 or 0
• True or False
• On or Off
• High or Low
• Yes or No
How to Read Ladder Logic

• Ladder logic uses symbolic expressions and a graphical editor for reading and

writing code making it easier.

If real world event is translated into ladder logic, it symbolically expressed in the

form of a normally open (NO) contact.

E.g. events like a button being pushed or a limit switch being activated.
How to Read Ladder Logic
Example

• Consider event ‘A’, has one of two states, TRUE or FALSE (1 or 0).

• Event is associated with the normally open (NO) contact can be TRUE or FALSE.

• If the event is TRUE, highlighted in green.

ladder logic truth table


How to Read Ladder Logic
• A normally open (NO) contact alone cannot decide
what action to take to

• automate the event

• It merely tells, what is the state of the event.

• Logic is theability to decide what action needs to be


takendepending on the state of one or more events.

• Logic concept – IF, THEN logic functions.


Ladder Logic Functions

• Consider an event = A. Allocated to normally closed (NC) contact.


• In ladder logic, the events are defined as PLC inputs.
• Let the result of the logic function = ‘Y’.
• The result of a rung logic function is defined as a PLC output.
• The two fundamental elements on a rung in a ladder diagram is first line of code.
Ladder Logic Functions
Ladder Logic Basics – In Built Functions

Two possible logic iterations:

• IF A = FALSE THEN Y= FALSE

• IF A = TRUE THEN Y = TRUE


Ladder Logic Functions
Ladder Logic Basics – In Built Functions

Two possible logic iterations:


• IF A = FALSE THEN Y =FALSE
• IF A = TRUE THEN Y = TRUE

Ladder logic diagram expressed symbolically in the


form of a normally open (NO) contact for the input and
the output relay coil.
Ladder Logic Functions

In ladder logic there are three more fundamental logic functions.

1. NOT

2. AND

3. OR
Ladder Logic AND Functions
Ladder Logic OR Functions
Ladder Logic
The sequence followed by a PLC when carrying out a program

1. Scan the inputs associated with one rung of the ladder program.

2. Solve the logic operation involving those inputs.

3. Set/reset the outputs for that rung.

4. Move on to the next rung and repeat operations 1, 2, 3.

5. Move on to the next rung and repeat operations 1, 2, 3.

6. So on until the end of the program with each rung of the ladder program.

The PLC then goes back to the beginning of the program and starts again.
Ladder Logic
35
36
37
38
39
Selection of a PLC
The following criteria need to be considered:
1. Types of inputs/outputs required, like;
- Isolation
- Out-board power supply for inputs/outputs
- Signal conditioning
2. lnput/Output capacity required
3. Size of memory required: linked with no. of I/O and complexity of program used
4.Speed and power required for CPU: linked to the no. of types of instructions,
handled by a PLC.
41
Control Process
 Physical Quantity is sensed in the form of
small current/voltage e.g. Temperature,
Pressure, Flow, Level etc (Sensor)
 This Electrical Signal is amplified to a
certain level (Amplifier)
 Then amplified analogue output is converted
into digital form. (Analogue to Digital
Converter i.e. A/D)
 This digital output is fed to the controller of
the system to control the various physical
quantities with the help of different devices.
(PLC, Microcontroller, DSP etc…)
Block Diagram Amplified
Analogue
output

Physical Amplifier A/D


Quantity
(Temperature, Pressure
etc..) Digital

Analogue Controller
output in (PLC, Microcontroller
etc…)
mA/mV
Control signals
Digital
/Analogue

Devices
(Motors etc…)
Traditional concept of PLC

• PLC performs relay equivalent functions

• PLC performs ON/OFF control

• Designed for industrial environment


PLC Operating Cycle
PLC Hardware Type
• A most basic PLC system is a self contained PLC
which has two terminal blocks, one for the Input
and other for the Output, called “Micros”.
• Typically they provide front panel LED status
indication of I/O and processor status.
2. Modular Chassis Based PLC
• The vast majority of PLC’s installed today
are modular chassis based PLC
consisting of:
3. Modular Chassis-less PLC
Systems
• The advanced PLC’s are chassis-less
• These are modular PLC systems.
• These systems also have:
-Processor - Power supply
-I/O modules -Communication card
• These components mount directly on a panel to
allow easy insertion and removal.
General PLC Blocks
Personal Computer
220V, 50/60Hz
RS 232

Power CPU Communic Analogue Analogue Digital Digital


Suppl at-ion Input Output Input Outpu
y Module t

AC to DC conversion (12V or 48V)


Timer Instructions
• Timer ON Delay(TON)

• Timer OFF Delay(TOF)

• Retentive timer-on delay(RTO)


Counter Instructions

• Counter Up (CTU)

• Counter Down (CTD)


Comparison Instructions

• Equal (EQU)
• Not Equal (NEQ)
• Less Than (LES)
• Less Than or Equal (LEQ)
• Greater Than (GRT)
• Greater Than or Equal (GEQ)

Some other instructions are Sequencer Instruction, Shift Register Instruction


etc…
Basic PLC Advantages
• Ease of Programming
• Ease of Maintenance
• Designed for Industrial Environment
• Suitable for Extreme Environmental
Conditions
• Quick Installation
• Adaptable to Change
Applications
61
INTRODUCTION
Special form of microprocessor-based controller –
programmable memory – store instruction – implement
logic, sequencing, timing, counting and arithmetic

• Rugged and designed to withstand vibrations,


temperature, humidity and noise
• Have interfacing for inputs and outputs already inside the
controller
• Easily understood programming language
8/9/2025 62
BASIC PLC SYSTEM
➢ Programming device – user
program RAM
➢ Program & data memory – system
ROM & data RAM
➢ Processor – CPU
➢ Communication interface –
address, data, control & I/O
system bus
➢ Power supply – battery
➢ Input interface – buffer,
optocoupler, input channel
➢ Output interface – latch, driver
interface, output channel
8/9/2025 63
INTERNAL ARCHITECTURE

8/9/2025 64
CONT…

INPUT LEVEL
OPTOCOUPLER – electrical isolation

OUTPUT CHANNEL
• Relay
• Transistor
• Triac

OUTPUT LEVEL
8/9/2025 65
CONT…
➢ Inputting programs – loading program into RAM through
programing device – then to ROM
➢ Forms of PLC
➢ single box – power supply, processor, memory &
input/output unit single box – i/p – 6/8/12/24 – o/p-4/8/16
– 300 to 1000 instructions in memory
➢ rack mounted – separate module for each element

8/9/2025 66
CONT…
➢ Input / output processing
➢ continuous updating – first i/p is read – checked with
program instruction – executed – o/p given out – similarly
next i/p is processed – delay of 3ms for each execution
➢ Mass I/O copying – all the i/p stored – buffer of RAM – as
& program instruction executed o/p are stored – buffer
RAM – last send to the output channel
➢ I/O Addresses – each inputs & outputs has address assigned
to it

8/9/2025 67
LADDER PROGRAMMING
➢ The vertical lines - power rails & the
horizontal lines - rungs.
➢ Each rung - defines one operation in
the control process.
➢ A ladder diagram must read from left
to right and from top to bottom
➢ Each rung must start with an input &
must end with an output
➢ Each rung can have more than one
input but only one output
➢ The input - rung left & the output -
right end of the rung

8/9/2025 68
CONT…
Normally open

Normally closed

output

Normally open – output occurs


when input is given

Normally closed - output occurs


when input is not given

8/9/2025 69
LOGIC FUNCTIONS
AND OR

NOR NAND

EX-OR

8/9/2025 70
LATCHING
Latching - to hold a coil energized -
the input which energized it ceases
Self-maintaining circuit - maintains
that state until another input is
received
It remembers its last state
Output is given as contact , OR logic
with input contact
Output is released only when input 2
(NC) is energizes
Eg: running a motor – motor latched
with start & stop as NC
8/9/2025 71
INTERNAL RELAY
➢ Do not exist as real-world switching devices - merely bits in the storage
memory - to hold data - behave in the same way as relays - being able
to be switched on or off and switch other devices on or off

➢ Multiple inputs

➢ Multiple outputs

➢ Resetting latch

➢ Battery backed

➢ Master control relay

➢ Jump relay
8/9/2025 72
CONT…

MULIPLE INPUTS – so MULTIPLE OUTPUTS - single


many inputs for single input activates so many
output. Eg: barrier gate outputs. Eg: CNC machine
8/9/2025 73
CONT…

BATTERY BACKED – output


RESETTING LATCH – controlled by internal relay –
unlatching the output remains energized even after
power failure
8/9/2025 74
CONT…
(CJP )

(EJP )

MASTER CONTROL
JUMP RELAY – to perform a
RELAY – to control large
set of instruction if one
number of outputs – turn
condition is satisfied if not do
on/off whole section of
some other set of instruction
ladder diagram
8/9/2025 75
TIMERS
➢ Timers - behave like relays with coils -
when energised - result in the closure /
opening of contacts - after some preset
time
➢ Timers count fractions of seconds or seconds
using the internal CPU clock.
Different forms of timers:
• Delay on timer
• Delay off timer
• On/off cyclic timer
• Cascaded timer
• Sequencing timer
8/9/2025 76
DELAY ON TIMER

➢ When a input is given timer coil is

activated – after preset time – timer

contact closes – activates the output

➢ Thus it delays input from reaching

output / output is delayed to happen

8/9/2025 77
DELAY OFF TIMER

➢ When a input is given – output is

activated - & also timer coil is

activated – after preset time – timer

contact (NC) opens its contact –

deactivates the output

➢ Thus it output is deactivated after

preset time

8/9/2025 78
ON / OFF CYCLIC TIMER
➢ When a input is given timer coil T1 is

activated – after preset time – timer

contact closes – activates the output

➢ And at the same time timer coil T2

also is activated – after preset time –

timer contact (NC) opens its contact

– deactivates the output

➢ Thus an output is activated for given

preset value & deactivated for some


8/9/2025 79
other preset value
CASCADED TIMER
➢ A timer can have preset value from 0.1 sec

to 999 sec

➢ If the delay time exceeds 999 sec, another

timer is needed for rest of the time

➢ ie for every 999 sec new timers are used

➢ Eg: if there is delay of 1200 sec,

1200-999=201, hence 2 timers one with 999

sec & other with 201 sec is needed

8/9/2025 80
SEQUENCING TIMER
➢ An output may be activated after

preset value of a previous output

being activated

➢ ie, output 2 is activated after n sec of

output 1 activated, delay between 2

outputs activated is n sec

➢ Eg; a pump need to be activated

after motor is on but with time delay

of n sec from motor being on

8/9/2025 81
COUNTERS
➢ Built-in elements in PLCs - allow the number

of occurrences of input signals to be

counted.

➢ Eg: items have to be counted as they pass

along a conveyor belt / the number of

revolutions of a shaft / perhaps the number

of people passing through a door.

➢ A counter - set to some preset number

value - when this value of input pulses

received - operate its contacts - normally

open contacts closed - normally closed


8/9/2025 82
contacts opened.
FORMS OF COUNTERS

➢ Down-counters count down from the preset value to zero, i.e. events are

subtracted from the set value - counter reaches the zero value - its contacts

change state.

➢ Up-counters count from zero up to the preset value, i.e. events are added

until the number reaches the preset value - counter reaches the preset

value - its contacts change state.


8/9/2025 83
SHIFT REGISTER
➢ Register – group of internal relay (EG: 4bit,

8 bit, 16 bit etc.,) – space - data stored

➢ Each internal relay - effectively open or

closed – states being designated as 0 & 1

➢ Shift register - number of internal relays

grouped together – allow stored bits to be

shifted from one relay to another

➢ 3 inputs - 1st to load data into the first

location of the register – 2nd command to

shift data along by one location – 3rd to

reset or clear data


8/9/2025 84
Cont..
➢ Eg: 8bit register – 8 internal relays

➢ Data stored are given below

➢ First command is given to load input 0 into IR 1

➢ Second command is to shift – hence every data moves by one location – so a

data overflows out at the end

➢ Each internal relay is connected to output so accordingly output activated

(if IR has 1) or deactivated (if IR has 0)


8/9/2025 85
DATA HANDLING
➢ Timers, counters & individual internal relays -
concerned with the handling of individual bits
- i.e. single on-off signals
Eg for data handling:
• Data movement
• Data comparison
• Arithmetic operations
• Code conversions
8/9/2025 86
DATA MOVEMENT

➢ Used to move data from one address to another

➢ when an input given in the rung - move occurs from the designated source

address to the designated destination address

➢ Eg: used to move preset value to a timer / counter or from a timer / counter to

a register

8/9/2025 87
DATA COMPARISON

➢ Used to compare two data values – from two different address

➢ when the data comparison instruction is activated - compares the data from

source (S) address to the data in destination (D) address – if true output is

activated or false output is deactivated.

➢ Eg: used to compare a digital value read from some input device with a

second value contained in a register

8/9/2025 88
DATA CONVERSION

➢ BCD-to-binary and binary-to-BCD conversions

➢ when the data conversion instruction is activated - converts the data

from source (S) address to the data in destination (D) address

➢ Eg: the input might be for a thumbwheel switch or the output to a

➢ decimal display

8/9/2025 89
ARITHMATIC OPERATION

➢ ADDITION, SUBTRACTION, MULTIPLICATIN & DIVISION

➢ when the arithmetic operation instruction is activated - does the

operation from 2 different address & stores in 3rd address

8/9/2025 90
INSTRUCTION LIST
IEC Mitsubis OMRO Sieme Operation Ladder diagram
1131-3 hi N ns

LD LD LD A Load operand Start a rung with


into result open contacts
register
LDN LDI LD AN Load negative Start a rung with
NOT operand into closed contacts
result register
AND AND AND A Boolean AND A series element
with open
contacts
ANDN ANI AND AN Boolean AND A series element
NOT with negative with closed
operand contacts
OR OR R O Boolean OR A parallel element
with open
contacts
ORN ORI OR ON Boolean OR A parallel element
8/9/2025 NOT with negative with closed 91
operand contacts
SELECTION OF PLC

• Number of input / output required


• Type of input / output
• Memory size required
• Speed and power of a CPU

8/9/2025 92
PLC: Timers and Counters

93
Function Blocks

• There are several types of function blocks in


ladder programming that implement:

➢ Logic operations (AND, OR, NOT, etc.).


➢ Math operations (addition, multiplication, etc.)
➢ Timers.
➢ Counters.

• In the following slides, we study different


types of timers and counters in PLC ladder
programming.

94
Timers

• Timers are used to operate devices for


certain period of time.

• PLC contains three basic types of timers:


1- On-delay timer (TON)
2- Off-delay timer (TOF)
3- Pulse-timer (TP)

95
Timers

96
ON-Delay Timer

97
ON-Delay Timer

• When the input IN changes from 0 to 1, the output


Q changes from 0 to 1 after a time interval set at
PT (preset time). During this interval, ET outputs
the elapsed time.

• If IN is 0 before ET reaches the preset time, the


elapsed time becomes 0.

• If IN is 0 after Q is 1, Q will be 0.

98
Example 1 (LG)

Develop the ladder logic that will turn on an


output light, 5 seconds after switch A has
been turned on.

99
Example 2
(Siemens)

• In this example, when input I0.3 turns on, timer T37


begins timing.
• T37 has a time base (resolution) of 100 ms (0.1 seconds).
The preset time (PT) value has been set to 150. This gives
15 seconds delay (150 x 100 ms).
• Therefore, 15 seconds after the I0.3 contact closes, timer
output becomes a logic 1, and output coil Q0.1 turns on.
If the switch opens before 15 seconds has elapsed, the
100
elapsed time (ET) resets to 0.
Off-Delay Timer

In Off-Delay timer, if the input IN


turned off (change from 1 to 0), the
timer waits for a certain time interval
and then turns off its output Q.

101
Pulse Timer

102
Pulse timer
• If IN is changes from 0 to 1, Q becomes
1 during the preset time, and if ET
reaches PT, Q becomes 0 automatically.

• Elapsed time ET increases when IN is 1


and holds the value when it reaches PT
and becomes 0 when IN is 0.

• It does not matter whether IN is 0 or 1


while the output Q is 1.

103
Counters

• PLC counter instructions keep track of


events. As it counts, a counter instruction
compares an accumulated count value to a
preset value to determine when the desired
count has been reached.

• Counters can be used to start an operation


when a count is reached or to prevent an
operation from occurring until a count has
been reached.
104
Counters
Types of counters in PLC:

1- Up counter (CU)
2- Down counter (CD)
3- Up-down counter (CUD)

105
Up counter (CTU)

106
Up counter (CTU)

• PV (preset value) is the count value to be stored in


the counter.

• Up counter CTU increases CV (current value) by 1


when input CU changes from 0 to 1 (i.e. positive
edge).

• Output Q is 1 when CV ≥ PV.

• When reset input R is 1, CV is cleared (becomes 0).

107
Example 3

In this example, Out1 will turn on after switch In2


has been closed 10 times. Push button In1 will reset
the counters.
108
Down Counter (CTD)
• The down counter starts its counts from a value
PV.
• PV is loaded to CV (current value) using the
input LD.
• Each time a positive edge occurs on CD
(count down) terminal the CV is decremented
by one.
• If CV <= 0, Q turns on.

109
Up/Down Counter (CTUD)
• Every +ve edge on CU increment CV by 1.
• Every +ve edge on CD decrement CV by 1.

CV QD QU
CV <= 0 1 0
CV >= 0 1
PV
• R: reset the counter
• LD: load CV with the value PV.

110
Example 4
A counter might be used to keep track of the
items in an inventory storage area.

111
Example 4, continued
• In the previous slide, Counter C48 is reset to zero when contact
I0.2 closes. This could be triggered automatically or manually to
indicate that the storage location is empty.

• When contact I0.0 closes, the counter counts up by 1. This


could be triggered by a proximity switch sensing that an item
has been placed in the storage location.

• When contact I0.1 closes, the counter counts down by 1. This


could be triggered by a proximity switch sensing that an item
has been removed from the storage location.

• When the accumulated count reaches 150, the counter turns on,
contact C48 closes, and output Q0.1 turns on. This could trigger
other logic in the program to divert new items to another location
until an item is removed from this location.
112
Thank You

113

You might also like