User guide
SFSU - Embedded Systems Tutorial Nano- Electronics & Computing Research Lab
36
In this project we used four 7-segment displays to show the values of switches being
turned on in binary. In a 7- segment display a high logic level will turn off the led and a low
logic level to a segment will turn the led on. To represent an LED with a seven-bit value we use
the values zero through six. To display a zero to a segment we set the hex value to be equal to
7b’1000000. This is because a zero will have all led on but the center led (number 6 on the figure
above). The code also uses a function to simplify the task of representing a bit value to a hex
value. Since the function DISPLAYNUMBERS only has one output it seemed like a function
instead of a task. In the function we have only one input value that represents a 4 bit switch
value, this value is passed through a series of if else statements to determine the hex value. At the
end of this program we assign all appropriate values to the represented LEDs.
There is a quick example of getting the LED’s, Switches, Keys, and 7 segment Hex
Display to function properly in the link below that goes more in detail about the 7 segment
display.
http://www.youtube.com/watch?v=SNCZGqWEtJg