Lab 3

Building a  Flip-Flop and a 7-Segment Display Decoder

FAQ

This is the grading form.

Goal

In this lab you will use NAND gates to implement two flip-flop circuits and then a 7 segment decoder for two binary digits. By pressing the four input switches in different combinations you will store 0 or 1s in the flip-flops and then the output wil be decoded so the 7-segment display will display a 0, 1 2, or a 3.

Flip-Flops


A Flip-Flop is a basic unit of memory that is used to store one bit. You can implement a flip-flop using NOR gates or using NAND gates. In this lab you will use NAND gates. The following is the circuit you will implement. Notice that in this circuit the voltages produced by the buttons is counterintuitive. It is 1 (+5) when a button is not pressed and 0 when the button is pressed.


A 7-segment Display

A 7-segment display is a display of numeric digits (and limited alphabetic characters) that is made of 7 LEDS in the following way:

7-segment display
Each segment corresponds to a pin in the base of the display.

 IMPORTANT: To power each segment you need to connect a 470ohm resistor in series with the segment. Otherwise, if you power the segment with +5V straight from the power supply, you can permanently damage your display. See the note below.


You can build digits 0 to 9 by powering the different segents:

Example:

7-segment
You will need first to implement the

The Initial Protoboard

Remove the LEDs, resistors and buttons from the previous lab and now put 4 buttons and resistors as indicated in the pictures. The buttons will be labeled from left to right S1, R1, S0, R0 where S1, R1 wll be the inputs for the flip-flop 1 an S0, R0 will be the inputs for the flip-flop 0.



Implement the flip-flop 1 as indicated in the picture. Notice the pin assignments of the NAND gates.






Notice that pressing the first button (S1) the LED turns ON and pressing the second button (R1) the LED will turn OFF.





You will implement another flip-flop 0 using the remaining NAND gates in the first chip. Implement the flip-flop in the space left above the push buttons and the first chip.

Connecting the display.

Put the seven-segment display in the right of the breadboard as indicated in the picture.



You will need to remove some tubing from one of the cables to isolate the terminals of the resistors. Otherwise the terminals of the resistors will touch each other causing a short circuit. To remove the tubing cut about 5 inches of wire and cut a little of the plastic in one of the sides. Then while holding the wire with the wire cutter, pull the plastic with the other hand as indicated in the picture.Cut the tubing in multiple pieces large enough to cover the terminals of the resistor while leaving out abut 1/4 of an inch.







Connect a resistor to each of the segments of the display. Here is the pin assignment.You will connect the resistors in such a way that column 48 in the breadboard  will have segment A, column 49 will have segment B, 50 will have segment C and so on until the decimal point is in column 55. See the pictures.




Notice that to turn on segment for example segment B, you need to put a resistor from terminal 16 in the display to ground and then a wire from terminal 1 (digit 1) to +5. You can move the blue wire in the picture from column to column to test the different segments as you add the resistors. Also, you can move the yellow wire at the bottom to select the different digits.















Implementing the 7-Segment-Display Decoder

You will implement a circuit that display the digits 0, 1, 2, and 3 in the display when the switches are pressed. When the flip flop F1=x=0 and F0=y=0 the display will show the digit 0. When the flip flop F1=x=0 and F0=y=1 the display will show the digit 1. When the flip flop F1=x=1 and F0=y=0 the display will show the digit 2. And when the flip flop F1=x=1 and F0=y=1 the display will show the digit 3. To show the digits, each segment will have its own circuit that implements the corresponding boolean expression.

The following table summarizes the truth table for all the segments for digits 0 to 3. Only the truth table for the segment a and the segment g are provided. You will have to fill in the values for all the other segments:

7-segment

Table 1
F1(x)
F0(y)
a
b
c
d
e
f
g
0
0
1



1


0
1
0



0


1
0
1



1


1
1
1



0



Using the "product of sums" technique, we can find out that a can be implemented by the function a=x+y' .
Using the "sum of products" we can find out that e=x'y'+xy'=y'(x'+x')=y'. Reducing this function we find that e=y'.

Table 2 summarizes the bolean expressons for each segment. Only the expressions for a and e are given. You have to fill in the table.

Table 2
Segment
Boolean Expression
a
x+y'
b

c

d

e
y'
f

g



For Next Lab

For next lab you will have to bring:
  1. Your protoboard implementing the flip-flop 0 and the 7-segment decoder. Make sure that setting and resetting the values in the flip-flops will show the corresponding digits in the seven-segment diaplay.
  2. Also bring a  printout of Table 1 and Table 2 filled in with all the values and expressions.