Main Content


Discrete- or continuous-time counter

  • Counter block

Simscape / Electrical / Control / General Control


The Counter block implements an incremental counter in either discrete or continuous time. The counter increments in response to one of these criteria:

  • Up — The input goes up.

  • Down — The input goes down.

  • Up-Down — The input goes up or down.



expand all

Counter value.

Data Types: single | double


expand all

Counter type.

Range for the output.

Timer period, in s.

Phase delay, in s. Add a phase delay to change the initial state of the counter.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For discrete-time simulation, set the sample time to a positive scalar. For continuous-time simulation, set the sample time to 0.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018b