Timer/Counter blocks > Counter function block

Counter function block execution

You select the counter type by configuring the COUNTER_TYPE and DETECT_TYPE parameters. The COUNTER_TYPE parameter defines the type of counter (increment or decrement). The DETECT_TYPE parameter defines the transition count type.

When COUNTER_TYPE is Up Counter (False or 0):

When COUNTER_TYPE is Down Counter (True or 1):

When DETECT_TYPE is Count on Rising Edge (False or 0):

When DETECT_TYPE is Count on TRUE (True or 1):

Each time COUNTER_TYPE or DETECT_TYPE is changed, the RESET_IN input is set True for one scan to reset the counter.

The following figure shows the timed response of the Counter function block for different input and parameter values:

Figure: Counter function block timing diagram