ModuloCounter

This block increments its output so that after each activation the value of the block output is given by the previous value of this output plus one, modulo base, where base is a block parameter.

    ModuloCounter

Library

Activate/SignalGenerators

Description

The Modulo block increments or decrements its output by a given Step value at each activation time modulo a base number. The initial output can be set to any number between 0 and base-1. The value -1 is also accepted and replaced with base-1.

The block is externally activated: an activation port is placed on the block to connect to an event generator such as an EventClock block.

Parameters

ModuloCounter_0

NameLabelDescriptionData TypeValid Values

ini_state

Counter initial output

Initial value (scalar). Any number between -1 and base-1. The value -1 is replaced with base-1.

Matrix

base

Modulo base

Base value for the modulo (scalar).

Matrix

step

Step

The increment or decrement of the counter. When positive, it counts up. When negative, it counts down.

Scalar

typ

Output datatype

The datatype of the output. Supported types are: Double, int8, int16, int32, uint8, uint16, uint32, inherit.

String

'double'
'int32'
'int16'
'int8'
'uint32'
'uint16'
'uint8'

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

1

Port 2

activation

input

1

Diagram

ModuloCounter

See Also