Programming Counters
Programming Counters
(Part 1)
(ITLCA3_12)
Week 7 SLIDE
BY
DR GU NNACHI
2024 Block 1
Faculty of ICT
Department of Computer Systems Engineering
LEARNING OBJECTIVES:
instructions
one-shot, contact
Faculty of ICT
Department of Computer Systems Engineering
Counter Instructions
Faculty of ICT
Department of Computer Systems Engineering
Every time the actuating lever is moved over, the counter adds one
Counter Instructions
• All PLC manufacturers offer some form of counter
instruction as part of their instruction set.
• One common counter application is keeping track of the
number of items moving past a given point as
illustrated in Figure 8-3.
• Counters are similar to timers except that they do not
operate on an internal clock but are dependent on
external or program sources for counting.
Faculty of ICT
Department of Computer Systems Engineering
Counter Instructions
Faculty of ICT
Department of Computer Systems Engineering
Counter Instructions
• The counter reset instruction must be used in conjunction with the
counter instruction. Up-counters are always reset to zero.
Faculty of ICT
• When programmed, the counter reset coilDepartment
(CTR)of Computer
is given the
Systems same
Engineering
reference address as the counter (CTU) that it is to reset. In this
Counter Instructions
• The counter reset instruction must be used in conjunction with the
counter instruction. Up-counters are always reset to zero.
Faculty of ICT
• When programmed, the counter reset coilDepartment
(CTR)of Computer
is given the
Systems same
Engineering
reference address as the counter (CTU) that it is to reset. In this
Counter Instructions
• Figure 8-6 shows a block-formatted counter.
• The instruction block indicates the type of counter (up or down), along
with the counter’s preset value and accumulated or current value.
• The counter has two input conditions associated with it, namely, the
count and reset.
• All PLC counters operate, or count, on the leading edge of the input
signal.
• The counter will not operate on the trailing edge, or on-to-off transition,
of the input condition.
Faculty of ICT
Department of Computer Systems Engineering
Counter Instructions
• Some manufacturers require the reset rung or line to be true to reset
the counter, whereas others require it to be false to reset the counter.
• For this reason, it is wise to consult the PLC’s operations manual before
attempting any programming of counter circuits.
• PLC counters are normally retentive; that is, whatever count was
contained in the counter at the time of a processor shutdown will be
restored to the counter on power-up.
• The down-counter decrements by 1 each time the rung containing Faculty of ICT
the
counter is energized. Department of Computer Systems Engineering
Counter Instructions
• Figure 8-7 illustrates the counting sequence of an up-
counter and a down-counter.
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
• The up-counter is an output instruction whose
function is to increment its accumulated value on
false-to-true transitions of its instruction.
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
• The Allen-Bradley SLC 500 counter file is file 5 (Figure 8-9).
• These three data words are the control word, preset word, and
accumulated word.
• Each of the three data words shares the same base address,
which is the address of the counter itself.
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
Faculty of ICT
Department of Computer Systems Engineering
Up-Counter
Faculty of ICT
Department of Computer Systems Engineering
Down-Counter
Faculty of ICT
Department of Computer Systems Engineering
Down-Counter
Faculty of ICT
Department of Computer Systems Engineering
Down-Counter
Faculty of ICT
Department of Computer Systems Engineering
Down-Counter
Faculty of ICT
Department of Computer Systems Engineering
Tutorial-Combining Counters and Timers
Faculty of ICT
Department of Computer Systems Engineering
THANK YOU
Faculty of ICT
Department of Computer Systems Engineering