Lab 2: Seven-segment displays

Now that we’re familiar with the Digital software simulator and combinational logic circuit design techniques (e.g., truth tables, sum of product (SOP) expressions, and SOP simplification using Karnaugh maps), it’s time to take things to the next level! In this lab, you’re going to be wiring up a 7-segment LED Display!

Pull the new starter code!

The starter code for each subsequent lab will be added directly into the same course repository. To update your individual repo, navigate to your workspace on the GitHub website and you should see a “Sync Fork” button. Click this and then “Update Branch.” Now if you run ``git pull’’ in your terminal, you will have all the materials you need.

IF YOU SEE AN OPEN PULL REQUEST BUTTON when you attempt to sync your workspace, please follow the below steps. If you have any trouble, come see the TAs in office hours and we will walk you through it!

  1. Check for an existing SSH key
  1. Create an SSH key if you do not have one already
  1. Add the key to GitHub
  1. Add the starter repo as a remote
  1. Sync your fork with the starter repo

If anything fails (SSH permission errors, etc.), see a TA in office hours for hands‑on help.

Seven-segment displays

Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. They get their name because there are seven different lights that turn on or off depending on what number or letter is being displayed. The image below shows how a 7-segment display can be used to represent the numbers 0-9.

7-segment-numbers

The display we are working with in this lab can display the digits 0-9 and the letters A-F. To control the value being shown, the display takes as an input a 4-bit binary number. The hexadecimal value of this 4-bit binary input is the character that will be displayed. For example, if the input is 0b1010, the letter A will be displayed. If the input is 0b0101, the number 5 will be displayed.

The 4 bits of the input are denoted as A, B, C, and D. For example, if the input is 0b1010, then A = 1, B = 0, C = 1, D = 0.

The name of each segment is shown below (Fa, Fb, Fc, Fd, Fe, Ff, Fg). You will create separate circuits to control each of the segments. If a segment should be on, the output of the driving circuit should be 1. If a segment should be off, the output of the driving circuit should be 0. For example, if the input to the display is 0b0000, we want to display the character 0, so Fa, Fb, Fc, Fd, Fe, and Ff would all be 1 and Fg would be 0.

7-segment-display

Task 1

To construct the circuit that controls the 7-segment display, you will need to fill out the provided truth table. The first row and first column of the outputs in the truth table have been filled out for you.

Using the given truth-table.csv file in the repo, fill in the rest of the truth table. Determine for each number or letter which of the 7 LED’s will be on (1) or off (0). When you finish the truth table, commit your changes and submit to Gradescope to see if it is correct. If you have an incorrect truth table, your circuits in the next part will not be correct!

Task 2

Now that we’ve constructed the truth table, it’s time to get ready to build the circuit! Before we start diagramming on Digital, we need to figure out how we’re going to wire up the 7-segment display.

Step 1

Using the completed truth table, create simplified Boolean expressions for each of the output segments Fa - Fg. We recommend using K-maps. When you are finished, you should have 7 Boolean equations (one for each segment in the display).

Step 2

You will implement your 7 circuits in Lab02.dig. In this file, you are provided with 4 input pins labeled A, B, C, and D. You are also provided with 7 output pins labeled Fa, Fb, Fc, Fd, Fe, Ff, Fg. You may move these pins around, but DO NOT CREATE NEW PINS.

Output

output wiring

The image below shows where to connect each of your circuits to the display. Note that the bottom right input on the display must connect to ground.

7 segment display

Components

Tips

Submit your assignment

Assignments are submitted through Gradescope.

  1. Commit and push your changes to your course workspace. (The only file you should have changed is Lab02.dig).
  2. Go to the COMP 311 course in Gradescope and click on the assignment called Lab 2.
  3. Click on the option to Submit Assignment and choose GitHub as the submission method. You may be prompted to sign in to your GitHub account to grant access to Gradescope. When this occurs, grant access to the Comp311 organization.
  4. Select your 311 workspace repository and the main branch.
  5. Your assignment should be autograded within a few seconds and you will receive feedback.
  6. If you receive all the points, then you have completed this lab assignment! Otherwise, you are free to keep pushing commits to your GitHub repository and submit for regrading up until the deadline of the lab.