This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Rollover Counter

Rollover Counter sample block


Simulink® Real-Time™ Library for Rollover


This block counts the number of times the output of an encoder block has rolled over. It counts up for positive direction rollovers and down for negative direction rollovers.

Block Parameters

Encoder Starting Value

Enter the starting value you want the encoder block to begin with. Match this value to the value in the encoder mask.

Rollover Threshold

Enter a rollover threshold value. To determine when a rollover has occurred, the model compares two consecutive encoder outputs and looks for a large jump. A large jump indicates a register overflow.

The threshold you enter defines a large jump. The smaller the threshold, the more likely the model will misinterpret a jump in successive encoder counts as a rollover. The larger the threshold, the more likely the model will not detect a rollover. Ideally, choose a number that is half the size of the register (for example, 2^(n-1)), where n is the size of the register in bits.

Was this topic helpful?