0% found this document useful (0 votes)
25 views9 pages

7 Segment Display

Uploaded by

thejayjay1127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

7 Segment Display

Uploaded by

thejayjay1127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Displaying Information using LEDs

So far, in our examples we have used LEDs as output devices


capable of displaying one bit of information. For example we
can turn then “ON” or “OFF” by writing a 1 or 0 to them.
LEDs are useful when it comes to displaying status information
e.g. the concepts of true/false, go/stop, on/off etc.
R LED
To turn ON the LED, write 1 5V +
To turn OFF the LED, write 0 0V V
-
Example: Traffic light controller

APSC 160 Display P2-4-3


Review of Binary Numbers
Before we look at using LEDs to display numbers, let’s review
binary or Base 2 number systems.
In binary, each bit represents a power of 2. A BYTE is 8 bits.
B b7b6b5b4b3b2b1b0 V ( B) b7 27 b6 26 ... b1 21 b0 20

Example: 10100010 V ( B) 1 27 0 1 25 0 0 0 1 21 0
128 32 2 162

Example: 11000011 V ( B) 1 27 1 26 0 0 0 0 1 21 1 20
128 64 2 1 195
Finally: 00000000 = 0 in the decimal number system
11111111 = 255 in the decimal number system

APSC 160 Display P2-4-4


Displaying Multi-bit Information
To display more than 1 bit, we can group several LEDs together.
Example: With 8 bits of data we can display any positive number
between decimal 0 and 255.

e.g. 11111111 = 255 in decimal representation


00001110 = 14 in decimal representation

By arranging 8 LEDs in a row we could display the value of an


8-bit binary number: e.g. decimal 10 = binary 00001010

0 OFF
1 ON
However, this type of representation of a binary number is NOT
really practical as it is difficult for us humans to interpret.
APSC 160 Display P2-4-5
7-Segment Displays
A more useful way to display decimal numbers involves using a
7-Segment Display.
Here we arrange a group of 7 LEDs into a pattern that allows us
to display the digits 0-9 by individually turning on/off segments
in the display (i.e. by writing a 0 or 1 to each segment).
Traditionally the segments are labelled ‘a’ to ‘g’ as shown below
a

f b

g
e c

Example: To display the decimal digit 7, turn on segments a, b, and c.


To display the digit 2, turn on segments a, b, g, e and d etc.
APSC 160 Display P2-4-6
7-Segment Displays (cont…)
Most displays also have an 8th segment to display a decimal
point (useful when displaying numbers etc.)

decimal point

So there are in fact 8 LEDs if you count the decimal point (but
they are still called seven segment displays!!). We can
completely control the display by writing a BYTE (8 bits) to it.

7 Segment displays are commonly used in digital clocks to


display time.

APSC 160 Display P2-4-7


Using the 7-Segment display
If we assume the following layout of bits in our byte and their
association to each segment, we can figure out what 8 bit
value (byte) we should write to display each decimal digit.

a b c d e f g p

8 bits (1 byte)

A ‘1’ in a position turns the segment on, and a ‘0’ turns it off.

LED segment OFF Write a 0


LED segment ON Write a 1
APSC 160 Display P2-4-8
Examples
What digit will be displayed if we write the value: 11110110?

a b c d e f g p
1 1 1 1 0 1 1 0 =9

What sequence of bits must we assign to our byte to display


the digit 5?

a b c d e f g p
1 0 1 1 0 1 1 0
which is 128 + 32 + 16 + 4 + 2 = 182

APSC 160 Display P2-4-9


Review - Number Systems – Decimal Numbers
We are naturally used to the decimal number system, i.e., we count in
terms of ten - 0, 1, 2, … 9, 10, 11, 12, …, 20, 21, …, 99, 100, …
A decimal integer is expressed by an n-tuple of n decimal digits

D d n 1d n 2d n 3... d1d 0

which represent the value

V ( D) dn 1 10 n 1
dn 2 10 n 2
... d1 101 d 0 10 0

di is 0, 1, 2, 3, …, 8, or 9.

APSC 160 Display P2-4-19


Review - Number Systems – Binary Numbers
In digital systems, binary numbers are used.
All numbers are represented as combinations of 0 and 1 digits:-
0, 1, 10, 11, 100, 101, …
In the binary number system, the same positional number
representation is used so that

B bn 1bn 2bn 3 ...b1b0


which represent the value :-

V ( B) bn 1 2n 1
bn 2 2n 2
... b1 21 b0 20

bi is 0 or 1.
As discussed earlier, each digit in the binary system, 1 and 0 (a
binary digit), is called a bit.
APSC 160 Display P2-4-20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy