Starting from:

$30

CS341-Lab 7 Seven Segment Display Solved

In this lab, you will learn how to use a 7 segment display. We will write to it to display numbers using a decoder chip that simplifies our code. When done, your display should loop through digits 0-9. The starter code can be found on GitHub under Lab 7.

 

Background Information
 

Seven Segment Displays are used in many consumer devices like calculators, clocks, watches, counters and microwave ovens. They are made out of LEDs and are low cost devices to display information. They come in a variety of colors and sizes. Some displays have a single digit and others have multiple digits.  

  

Seven segment displays consist of 7 LEDs, called segments, arranged in the shape of an “8” and a dot on the right side of the digit that serves as a decimal point. Each segment is named with a letter A to G, and DP for the decimal point. For example, to display a number 7, the segments A, B and C must be lit up.  

             

To make the matching of digits to segments easier, seven segment display chips come with a 4bit decoder which maps the digits in binary (e.g. 0 – 9 and some special characters) to the correct segments to display that number. Instead of lighting the groups of segments to form a digit, the user programs the 4-bit decoder to light up the digits as follows:

   

                    Decoder Input    
 
bit 3 
bit 2 
bit 1 
bit 0 
Display character 
LOW 
LOW 
LOW 
LOW 

LOW 
LOW 
LOW 
HIGH 

LOW 
LOW 
HIGH 
LOW 

LOW 
LOW 
HIGH 
HIGH 

LOW 
HIGH 
LOW 
LOW 

LOW 
HIGH 
LOW 
HIGH 

LOW 
HIGH 
HIGH 
LOW 

LOW 
HIGH 
HIGH 
HIGH 

HIGH 
LOW 
LOW 
LOW 

HIGH 
LOW 
LOW 
HIGH 

HIGH 
LOW 
HIGH 
LOW 
Special Character 
HIGH 
LOW 
HIGH 
HIGH 
Special Character 
HIGH 
HIGH 
LOW 
LOW 
Special Character 
HIGH 
HIGH 
LOW 
HIGH 
Special Character 
HIGH 
HIGH 
HIGH 
LOW 
Special Character 
HIGH 
HIGH 
HIGH 
HIGH 
Special Character 
 

In this lab we will make use of 4 digital pins for the decoder: pin 4 for bit 0, pin 5 for bit 1, pin 6 for bit 2, and pin 7 for bit 3.  

The Circuit
  

 

Closeup 

 

 

Program the Hardware
Program your 7 segment display so that it counts up from 0. When it gets to 9 it should loop back to 0 again. Make sure your 7 segment display is set to “cathode”. The default is anode which is incorrect.  

More products