Counter

Counts how many times this block was executed

Category: Source

Description:

This block can be used to count how many times a diagram was executed. This increment can happen in a task or Finite State machine.

The block behavior is defined by:

y0=InitialConditionyk=yk1+step,if yk1<resetyk=InitialCondition,otherwise\begin{align} y_0 &=Initial Condition \\ y_k &= y_{k-1} + step, \text{if $y_{k-1}<$$reset$} \\ y_k &= Initial Condition, \text{otherwise}\end{align}

Figure 1 shows the Counter Properties dialog with the 'Initial Condition,' 'Step,' and 'Reset' parameters being configured.

Figure 1 - Counter block dialog

Figure 2 shows an example of two Counter block in a Task with 1s of period. Both of them have the Initial Condition and Step equal to 1 but Counter block 2 has a reset value equal to 5 and Counter block 1 reset is disable.

Figure 2 - Two Counter signals in a Scope

Parameters:

Defines the initial condition of the Output Signal. This value will be used again in a reset situation.

Defines the step value increment used in every execution of the block.

Enable or disable reset of the Counter block.

When the counter achieves the reset value the counter block will reset.

Ports:

Input

Returns the current counter value.

Data Types:

About MWF

MWF is a traditional Brazilian company that provides a wide range of electronic and mechatronic products for industry sectors such as automotive, agricultural machinery and aerospace.

Contact Us

Rua Doutor Siqueira, 139 / Sala 804 Campos dos Goytacazes - RJ, Brasil

contact@mwf-technologies.com

© 2018-2026 MWF. All rights reserved.