Main Content

Counter

Discrete- or continuous-time counter

  • Counter block

Libraries:
Simscape / Electrical / Control / General Control

Description

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.

Ports

Output

expand all

Counter value.

Data Types: single | double

Parameters

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