Basic Timers and Counters

Many times we will want to take action in a control program based on more than the states of discrete inputs and outputs. Sometimes, we will want to turn something on after a delay, or count the number of times a switch is hit. To do these simple tasks, we will need Timers & Counters.

Simple Timers

A timer is simply a control block that takes an input and changes an output based on time. There are two basic timer types we will deal with initially (there are other advanced timers, but we will start with the basics first) – On-Delay Timer and the Off-Delay Timer.

On-Delay Timer - this timer takes an input, waits a specific amount of time, then turns ON an output (or allows logic to flow after the delay).

Off-Delay Timer – this timer takes turns ON an output (or allows logic to flow) and keeps that output ON until the set amount of time has passed, then turns it OFF (hence off-delay)

Simple Counter

A counter simply counts the number of events that occur on an input. There are two basic types of counters – Up counter and a Down counter.

Up Counter – as its name implies, whenever a triggering event occurs, an up counter increments the counter.

Down Counter - whenever a triggering event occurs, a down counter decrements the counter.