A decimal counter with a display
The problem
Build a model of a counter that counts 0 to 9 and shows each digit on a seven-segment display, using a mod-10 counter and a decoder built from a truth table.
Requirements
- Write a modulo-10 counter from T or D flip-flops, as a function from the current 4-bit state to the next
- Write the seven truth tables of the segments a to g for the digits 0 to 9, and treat 10 to 15 as don't-cares
- Simplify one segment with a Karnaugh map, using the don't-cares, and check it against the table
- Print the segments of the display as text for 12 clock pulses
Technologies
- Python
- Karnaugh maps
- Counters and decoders
Step by step
- Write the next-state function of the mod-10 counter and check that it goes 0, 1, ..., 9, 0.
- Write the segment table for the digits, one row for each digit.
- Pick the segment e and simplify it with a K-map with don't-cares.
- Check the simplified formula against the table on the rows 0 to 9.
- Draw each digit as a small picture of text lines, and run the counter for 12 clocks.
Expected result
A program that counts 0 to 9 and back to 0, and prints each digit as a seven-segment picture, together with a verified formula for one segment.
How it is evaluated
- The counter wraps from 9 to 0
- The simplified segment formula is correct on all ten digits
- The don't-care rows are used and explained
Ways to improve it
- Simplify all seven segments and count the gates saved
- Count 0 to 59 with two digits
- Add an enable input that freezes the count