What is Counter?
- Up counters which only count upwards (1, 2, 3, …) and which are usually denoted as CTU (count up ).
- Down counters which only count down (9, 8, 7, …) and that are usually denoted as CTD (count down).
- Up-Down counters which count both ascending and descending (1, 2, 3, 4, 3, 2, 3, 4, 5, …) and that are usually denoted as UDC or simply C.
The count up counter (CTU) counts from the current value whenever the count up (CU) input goes from OFF to ON.
When the counter value reaches the preset valve (PV), the counter Bit turns to logic 1, the course reset when the counter output turn ON.
Or counter stop counting when it counting reaches its maximum value 32767.
The down counter (CTD) counts down from the current value whenever the input of count down (CD) goes from off to on.
The output of counter becomes Logic 1 when the counter value reaches zero, which the counter stop counting when it’s value reaches zero.
When the load output (LD) turns on, the counter resets and loads the current value with the preset value (PV).
The count up / down counter (CTUD) counts up every time the (CTUD) count up (CU) input is activated and counts down every time the count down input (CD) is activated.
The counter bit for the designated counter is a logic 1 if the current value is equal to or greater than the preset value (PV). The counter bit is a logic 0 otherwise.
When the load input (LD) turns on, the counter resets and loads the current value with the preset value (PV).
High Speed Counter (HSC):
The above-mentioned counters are implemented by software. Fast counters. That is, while ordinary counters do not exist physically but are simulated in the PLC monitor program, high-speed counters do exist as an element of the hardware and function in this way independently of the PLC scan time.
The counting frequency of the code counter of a normal PLC can exceed only tens of Hz (depending on the time of the scan). If the input signal frequency is higher than that, the high-speed counter (HSC) must be used, otherwise the count of losses or even the counting that occur.
This counter uses 2 inputs: the first is the RESET input which, when activated, restores the current or accumulated value of the PLC to zero.
The second entry is where the pulses you wish to count would enter. For example, if you are counting how many pieces pass through the front of an inductive detector that is physically connected to input 0001, then you must place contact at the closure with address 0001 on the second input line (press).
Two forms of HSC are typically introduced for PLC. The Hardware High-speed Counter (HHSC) used a special hardware circuit and the Software High-speed Counter (SHSC) which will interrupt the CPU to perform the increment / decrement counting operation when the signal changes are counted. Up to 4 HHSCs (in SoC chips) and 4 SHSCs are available from FBs-PLC. All of them are high-speed counters of 32-bit.
Applications of PLC Counters
A counter could be used to keep track of a parking lot’s number of vehicles. The counter counts when vehicles enter the lot through an entrance gate. The counter counts down as vehicles exit the lot through an exit gate. When the lot is filled with a sign at the entrance gate, the lot is full.
- Packaging line control
- Bottle filling system