How do I handle register rollover for xPC Target encoder blocks?

Technical Source
2 min readOct 29, 2021

I am using xPC Target Encoder blocks in my Simulink model. I would like to know how to handle potential register rollover.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

This enhancement has been incorporated in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:

Encoder boards have a fixed size counter register of 16 bits, 24 bits, or 32 bits. Regardless of the size, the register always eventually overflows and rolls over. This can happen in either the positive or negative direction.

Some boards provide a hardware mechanism to account for overflows or rollovers. As a best practice, you should design your model to always deal with overflows or rollovers. An initial count can handle the issue for some applications.

To handle register rollovers, you can use standard Simulink blocks to design the following counter algorithm types:

Rollover Counter — Count the number of rollovers

Extended Counter — Provide an extended counter that is not limited by register size

The attached files contain example Rollover Counter and Extended Counter blocks (handle rollover in positive direction).

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.