Extended Counter

Extended Counter sample block (not recommended)


Simulink® Real-Time™ Library of Drivers No Longer Recommended for Use.

To open this library, type xpcobsoletelib in the Command Window.


This block outputs a count not limited to the number of bits on the board encoder counter register. It receives as input the output of an encoder block.

Block Parameters

Rollover Counts

Enter the number of rollover counts. This is the number at which the rollover occurs. This value should normally be 2^n, where n is the number of bits in the encoder counter register. Each rollover equals this number.

Encoder Starting Value

Enter the starting value with which the encoder block begins. This value should match the value in the encoder mask.

Rollover Threshold

Enter a rollover threshold value. This subsystem infers when a rollover occurs by comparing successive outputs from an encoder block. When the difference between outputs is extremely large, a rollover has occurred. Enter a value that is

  • Larger than the worst-case difference between successive outputs (to prevent declaring a rollover when it was just a large step)

  • Less than the maximum count value minus the worst-case difference (to prevent missing a rollover)

    Ideally, enter the value 2^(n-1), where n is the number of bits in the encoder counter register. The default is 2^15.

Was this topic helpful?