(Developed using R2007b)
Timers and counters are essential elements in hardware design. A timer can be used to measure elapsed time and a counter is used to count number of external events in hardware circuits.
This demo shows how to build timers and counters in Embedded MATLAB. The attached model contains implementations of the following counters.
Up Down Counter (With enable)
Preset Clear Counter
Call Count Detector
Gray code is a binary numeral system where two successive values differ in only one digit. Gray codes are widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems. A 4bit gray code counter has the following binary sequence as its output.
A ring counter is a type of counter composed of a circular shift register.
The output of the last shift register is fed to the input of the first register.
A Johnson counter is also called as a walking ring counter wherein the output of the last shift register is inverted and fed back to the input of first shift register. A 4bit johnson counter has the following binary sequence as its output.
Modulo N Counter:
The total number of stable states a counter has indicates its MODULUS. A Mod3 counter has the following binary sequence as its output.
Kiran Kintali (2022). Modeling Counters and Timers in Embedded MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/16302-modeling-counters-and-timers-in-embedded-matlab), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!