Chapter 5. Seven-Segment LED Displays and Finite‑State Machines

In this chapter, we will create a new project that will teach you how to use the seven-segment displays on the IO Shield, shown in Figure 5-1. Seven-segment displays are common, and you have likely seen them all over the place (for example, on microwave ovens). We will continue building on this project to create a stopwatch that will serve as an example for a finite-state machine.

Seven Segment Display
Figure 5-1. Seven-segment displays on the IO Shield

Finite-state machines, or FSMs, are an important design idea that will allow you to create designs with complex behavior. The basic idea is that your design has a finite set of states that it can be in, and various inputs will cause it to transition between states. The classic example of an FSM is a traffic light. The light can be in a few states: green in one direction, red in both directions, green in the other direction, and so forth. Depending on where cars are detected, it will transition between these states in a specific way.

Single Digit

On the IO Shield, each segment from a digit is connected to the same segment of the other three digits. Given this, it seems as if all four digits would always display the same thing. However, each digit can be turned on and off individually. This is accomplished by connecting the common pin of each digit to a transistor. By turning the transistors ...

Get Learning FPGAs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.