The leader in industrial automation and control solutions

How to Program Counters

Watch on YouTube

Skills you’ll gain: The basics and features of counters in the PLC programming software MapleLogic.

Software Required

Hardware Required

In this tutorial a Maple Micro PLC-FB1616P will be the master device and a Maple Modular PLC-ES0808P is the slave device.

*Note – Any Maple Modular or Maple Micro PLC can be used.

What is a Counter?

PLC Counters are internal PLC instructions that can be used to count input or output signals in the PLC program. Two main types of counters are an up counter and a down counter.

Maple Logic has four types of counters.

CTU (Up Counter)

An Up Counter instruction counts upward by one. When disabled, the CTU instruction retains its accumulated value.

When X0.1 is enabled [ON], the CTU instruction increments the counter by one. When the accumulated value reaches 3, C1.0 and Y0.1 will be set. It will keep counting up until it is cleared.

When X0.2 is ON, the accumulated value is cleared.

CTD (Down Counter)

A Down Counter counts downward by one. When disbabled, the CTD instruction retains its accumulated value.

When X0.3 is enabled [ON], the CTD instruction decrements the counter by one. When the accumulated value reaches 0, C2.0 and Y0.2 will be set.

When X0.4 is ON, the accumulated value is cleared and goes back to the preset value [3].

CTUD (Up/Down Counter)

An Up and Down Counter counts upward by one when the Counter Up bit is set and the instruction counts downward by one when the Counter Down bit is set.

When X0.5 is enabled [ON], the CTUD instruction increments the counter by one and when X0.6 is enabled [ON] the CTUD instruction decrements the counter by one. When the accumulated value reaches the preset value, the counter bit is set. It will keep counting up until it is cleared.

When X0.7 is ON, the accumulated value is cleared.

CTR (Up Counter- Retentive)

An Up Counter (Retentive) counts upward by one. When disabled, the CTR instruction retains its accumulated value. ONLY if the accumulated value reaches the preset value, the counter will be set and the accumulated value is cleared.

When X0.8 is enabled [ON], the CTR instruction increments the counter by one. When the accumulated value reaches 3, C4.0 and Y0.4 will be set and the accumulated value will reset to 0.

When X0.9 is ON, C4.0 and Y0.4 turn OFF.

Sample Project

The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.

Download MapleLogic Sample Project

Resources & Documentation

Maple PLC/MapleLogic Resources

More Tutorials Sample Projects

See our Support Center for a complete list of Quick Start and Installation Guides

Kyle Nicholas Avatar