Definition:
In the PLC-5 system, a Counter is a type of data file used to count events — whether incrementing (count up), decrementing (count down), or both.
Default File Number:
Examples:C: Counter Data File
C5:0
→ First counterC5:1
→ Second counter, and so on
Counter Register Structure
Each counter element (C5:x
) contains the following internal structure:
- .ACC — Accumulated Value (current count)
- .PRE — Preset Value (target count to trigger
DN
)- .EN — Enable Bit (1 when conditions are true)
- .DN — Done Bit (1 when
ACC = PRE
)- .CU — Count Up Bit (active when rising edge is detected)
- .CD — Count Down Bit (active when falling edge is detected)
- .OV — Overflow Bit (active if count exceeds limits)
- .UN — Underflow Bit (active if count goes below zero)
Types of Counters in PLC-5
- CTU (Count Up)
IncreasesACC
when the input rises from 0 to 1.
WhenACC >= PRE
, theDN
bit becomes 1. - CTD (Count Down)
DecreasesACC
on a rising input edge.
DN
becomes active ifACC <= 0
, depending on logic. - RES (Reset)
ResetsACC
to 0 and clears theDN
bit.
Application Example
Suppose you want to count the number of cartons passing an optical sensor:
- The sensor is connected to
I:1/0
- The counter
CTU
usesC5:0
- Set
C5:0.PRE = 10
- If 10 cartons pass, then:
C5:0.ACC = 10
C5:0.DN = 1
(indicating completion)
Historical & Philosophical Note
The PLC-5 is more than just a control system—it’s the industrial liturgy of an era that built the foundations of SCADA and DCS. Its counter register is a reflection of how digital logic imagines time and quantity, like a string of prayer beads for engineers—each pulse, a step toward process enlightenment. 😌