You are on page 1of 14

LAB RAPORT

Course Title: Microprocessor & Interfacing sessional


Submitted to:

Teacher Name: Tanveer Ahmed


Designation: Senior Lecturer

Department of Computer Science & Engineering


Stamford University Bangladesh

Submitted by:

Name: Merajul Islam


Student Id: CSE-063 07508
Batch: CSE-63-D
7 Segment LED Display

What is 7-segment Display?

An LED or Light Emitting Diode, is a solid state optical p n-junction diode which emits
light energy in the form of photons.

The emission of these photons occurs when the diode junction is forward biased by
an external voltage allowing current to flow across its junction, and in Electronics we
call this process electroluminescence.
The actual color of the visible light emitted by an LED, ranging from blue to red to
orange, is decided by the spectral wavelength of the emitted light which itself is
dependent upon the mixture of the various impurities added to the semiconductor
materials used to produce it.

7-segment Display
Light emitting diodes have many advantages over traditional bulbs and lamps, with
the main ones being their small size, long life, various colors, cheapness and are
readily available, as well as being easy to interface with various other electronic
components and digital circuits.
But the main advantage of light emitting diodes is that because of their small die
size, several of them can be connected together within one small and compact
package producing what is generally called a 7-segment Display.
The 7-segment display, also written as “seven segment display”, consists of seven
LEDs (hence its name) arranged in a rectangular fashion as shown. Each of the
seven LEDs is called a segment because when illuminated the segment forms part
of a numerical digit (both Decimal and Hex) to be displayed. An additional 8th LED is
sometimes used within the same package thus allowing the indication of a decimal
point, (DP) when two or more 7-segment displays are connected together to display
numbers greater than ten.
The difference between the two displays, as their name suggests, is that the
common cathode has all the cathodes of the 7-segments connected directly
together and the common anode has all the anodes of the 7-segments connected
together and is illuminated as follows.
1. The Common Cathode (CC) – In the common cathode display, all the cathode
connections of the LED segments are joined together to logic “0” or ground. The
individual segments are illuminated by application of a “HIGH”, or logic “1” signal via
a current limiting resistor to forward bias the individual Anode terminals (a-g).

Common Cathode 7-segment Display

2. The Common Anode (CA) – In the common anode display, all the anode
connections of the LED segments are joined together to logic “1”. The individual
segments are illuminated by applying a ground, logic “0” or “LOW” signal via a
suitable current limiting resistor to the Cathode of the particular segment (a-g).

Common Anode 7-segment Display


In general, common anode displays are more popular as many logic circuits can sink
more current than they can source. Also note that a common cathode display is not a
direct replacement in a circuit for a common anode display and vice versa, as it is
the same as connecting the LEDs in reverse, and hence light emission will not take
place.
Depending upon the decimal digit to be displayed, the particular set of LEDs is forward biased.

7-Segment Display Segments for all Numbers.

Then for a 7-segment display, we can produce a truth table giving the individual
segments that need to be illuminated in order to produce the required decimal digit
from 0 through 9 as shown below.

7-segment Display Truth Table


Driving a 7-segment Display
Although a 7-segment display can be thought of as a single display, it is still seven
individual LEDs within a single package and as such these LEDs need protection
from over current. LEDs produce light only when it is forward biased with the amount
of light emitted being proportional to the forward current.
This means then that an LEDs light intensity increases in an approximately linear
manner with an increasing current. So this forward current must be controlled and
limited to a safe value by an external resistor to prevent damage to the LED
segments.
The forward voltage drop across a red LED segment is very low at about 2-to-2.2
volts, (blue and white LEDs can be as high as 3.6 volts) so to illuminate correctly, the
LED segments should be connected to a voltage source in excess of this forward
voltage value with a series resistance used to limit the forward current to a desirable
value.
Typically for a standard red colored 7-segment display, each LED segment can draw
about 15 mA to illuminated correctly, so on a 5 volt digital logic circuit, the value of
the current limiting resistor would be about 200Ω (5v – 2v)/15mA, or 220Ω to the
nearest higher preferred value.
So to understand how the segments of the display are connected to a 220Ω current
limiting resistor consider the circuit below.

Driving a 7-segment Display

In this example, the segments of a common anode display are illuminated using the
switches. If switch a is closed, current will flow through the “a” segment of the LED to
the current limiting resistor connected to pin a and to 0 volts, making the circuit. Then
only segment a will be illuminated. So a LOW condition (switch to ground) is required
to activate the LED segments on this common anode display.
But suppose we want the decimal number “4” to illuminate on the display. Then
switches b, c, f and g would be closed to light the corresponding LED segments.
Likewise for a decimal number “7”, switches a, b, c would be closed. But illuminating
7-segment displays using individual switches is not very practical.
7-segment Displays are usually driven by a special type of integrated circuit (IC)
commonly known as a 7-segment decoder/driver, such as the CMOS 4511. This 7-
segment display driver which is known as a Binary Coded Decimal or BCD to 7-
segment display decoder and driver, is able to illuminate both common anode or
common cathode displays. But there are many other single and dual display drivers
available such as the very popular TTL 7447.
This BCD-to-7 segment decoder/driver takes a four-bit BCD input labelled A, B,
C and Dfor the digits of the binary weighting of 1, 2, 4 and 8 respectively, has seven
outputs that will pass current through the appropriate segments to display the
decimal digit of the numeric LED display.
The digital outputs of the CD4511 are different from the usual CMOS outputs
because they can provide up to 25mA of current each to drive the LED segments
directly allowing different coloured LED displays to be used and driven.

Driving a 7-segment Display using a 4511

In this simple circuit, each LED segment of the common cathode display has its own
anode terminal connected directly to the 4511 driver with its cathodes connected to
ground. The current from each output passes through a 1kΩ resistor that limits it to a
safe amount. The binary input to the 4511 is via the four switches. Then we can see
that using a BCD to 7-segment display driver such as the CMOS 4511, we can
control the LED display using just four switches (instead of the previous 8) or a 4-bit
binary signal allowing up to 16 different combinations.
Most digital equipment use 7-segment Displays for converting digital signals into a
form that can be displayed and understood by the user. This information is often
numerical data in the form of numbers, characters and symbols. Common anode and
common cathode seven-segment displays produce the required number by
illuminating the individual segments in various combinations.
LED based 7-segment displays are very popular amongst Electronics hobbyists as
they are easy to use and easy to understand. In most practical applications, 7-
segment displays are driven by a suitable decoder/driver IC such as the CMOS 4511
or TTL 7447 from a 4-bit BCD input. Today, LED based 7-segment displays have
been largely replaced by liquid crystal displays (LCDs) which consume less current.

Dot Matrix LED Display

LED dot matrices are very popular means of displaying information as it allows both
static and animated text and images. Perhaps, you have encountered them at gas
stations displaying the gas prices, or in the public places and alongside highways,
displaying advertisements on large dot matrix panels. In this experiment, we will discuss
about the basic structure of a monochrome (single color) LED dot matrix and its
interface with a microcontroller to display static characters and symbols.

Theory of LED dot matrix display


In a dot matrix display, multiple LEDs are wired together in rows and columns. This is
done to minimize the number of pins required to drive them. For example, a 8×8 matrix
of LEDs (shown below) would need 64 I/O pins, one for each LED pixel. By wiring all the
anodes together in rows (R1 through R8), and cathodes in columns (C1 through C8),
the required number of I/O pins is reduced to 16. Each LED is addressed by its row and
column number. In the figure below, if R4 is pulled high and C3 is pulled low, the LED in
fourth row and third column will be turned on. Characters can be displayed by fast
scanning of either rows or columns. This tutorial will discuss the method of column
scanning.

Structure of a 8x8 LED dot matrix

The LED matrix used in this experiment is of size 5×7. We will learn how to display still
characters in a standard 5×7 pixel format. The figure below shows which LEDs are to be
turned on to display the English alphabet ‘A’. The 7 rows and 5 columns are controlled
through the microcontroller pins. Now, lets see in detail how it works.

Suppose, we want to display the alphabet A. We will first select the column C1 (which
means C1 is pulled low in this case), and deselect other columns by blocking their ground
paths (one way of doing that is by pulling C2 through C5 pins to logic high). Now, the first
column is active, and you need to turn on the LEDs in the rows R2 through R7 of this
column, which can be done by applying forward bias voltages to these rows. Next, select the
column C2 (and deselect all other columns), and apply forward bias to R1 and R5, and so
on. Therefore, by scanning across the column quickly (> 100 times per second), and turning
on the respective LEDs in each row of that column, the persistence of vision comes in to
play, and we perceive the display image as still.
A standard 5x7 LED dot matrix display structure

The table below gives the logic levels to be applied to R1 through R7 for each of the
columns in order to display the alphabet ‘A’.

Row values of each column for displaying the alphabet A

Scanning across the columns and feeding with appropriate row values
You should have noted that across each row, one pin is sourcing the current for only
one LED at a time, but a column pin may have to sink the currents from more than one
LED. For example, the column C1 should be able to sink the currents from 6 LEDs while
displaying the alphabet ‘A’. A microcontroller’s I/O pin cannot sink this much of current,
so external transistor arrays are required. I am using ULN2003A IC which has seven
built-in Darlington transistor arrays (see below). The inputs of ULN2003A are active
high. This means the input pins must be supplied with logic high in order to bring the
corresponding output pins to ground. The schematic of the Darlington transistor array
inside the ULN2003A chip is shown below.

Pin diagram and schematic of ULN2003A (Darlington transistor arrays)

Circuit Setup
The circuit setup for this experiment is quite simple. You need seven 330 ? resistors in
series with rows R1 through R7 to limit the current through the LEDs. Then the rows are
driven by RB0 through RB6 pins of PIC18F2550. The columns are connected to the five
outputs of ULN2003A. The corresponding five input pins of ULN2003A IC are controlled
by RA0 through RA4 pins of PIC18F2550. The microcontroller will, therefore, scan across
the column by sending appropriate bits to PORTA. For example, setting RA0 to 1 and
clearing RA1 through RA4 bits, will select the first column. The microcontroller will wait
for about 1 ms before switching to the next column. At each column, the microcontroller
will output the corresponding row value at PORTB to turn on the appropriate LEDs in the
column that are required to display the specific character. The switching between
columns is fast enough to deceive the human eyes and a steady character is displayed.
.
Circuit diagram for interfacing a 5x7 LED dot matrix with PIC18F2550

Circuit setup showing a StartUSB board with a 6x7 LED dot matrix (the sixth column is discarded here)

Software
The major part of this experiment is the software routine to scan the columns and feed the rows with
appropriate values. The column-specific row values for display characters can be either defined in
RAM or stored in the program memory in case the on-board RAM is not sufficient enough. In micro C,
the variables are saved in RAM and constants are stored in program memory. So, if your PIC does not
have enough RAM, you can define a constant array to store the row values so that a part of the
program memory is occupied by it to free up the on-board RAM. PIC18F2550 has quite a bit of RAM
(2 KB), so I have used RAM to store the row values for alphabets A through Z. Here’s how I define it
in micro C,
I have written a simple program in micro C to display the alphabets A through Z sequentially, and
some special characters too. You can watch the video below to see how they look like on the dot
matrix display’

Liquid Crystal Display (LCD)

Reflective twisted liquid crystal display.

1. Polarizing filter film with a vertical axis to polarize light as it enters.


2. Glass substrate with ITO electrodes. The shapes of these electrodes will determine the
shapes that will appear when the LCD is switched ON. Vertical ridges etched on the surface
are smooth.
3. Twisted liquid crystal.
4. Glass substrate with common electrode film (ITO) with horizontal ridges to line up with the
horizontal filter.
5. Polarizing filter film with a horizontal axis to block/pass light.
6. Reflective surface to send light back to viewer. (In a backlit LCD, this layer is replaced or
complemented with a light source.)

A liquid-crystal display (LCD) is a flat-panel display or other electronically modulated optical


device that uses the light-modulating properties of liquid crystals. Liquid crystals do not emit light
directly, instead using a backlight or reflector to produce images in color or monochrome.[1] LCDs are
available to display arbitrary images (as in a general-purpose computer display) or fixed images with
low information content, which can be displayed or hidden, such as preset words, digits, and seven-
segment displays, as in a digital clock. They use the same basic technology, except that arbitrary
images are made up of a large number of small pixels, while other displays have larger elements.
LCDs are used in a wide range of applications including LCD televisions, computer
monitors, instrument panels, aircraft cockpit displays, and indoor and outdoor signage. Small LCD
screens are common in portable consumer devices such as digital cameras, watches, calculators,
and mobile telephones, including smartphones. LCD screens are also used on consumer
electronics products such as DVD players, video game devices and clocks. LCD screens have
replaced heavy, bulky cathode ray tube (CRT) displays in nearly all applications. LCD screens are
available in a wider range of screen sizes than CRT and plasma displays, with LCD screens available
in sizes ranging from tiny digital watches to very large television receivers.
Since LCD screens do not use phosphors, they rarely suffer image burn-in when a static image is
displayed on a screen for a long time, e.g., the table frame for an airline flight schedule on an indoor
sign. LCDs are, however, susceptible to image persistence.[2] The LCD screen is more energy-
efficient and can be disposed of more safely than a CRT can. Its low electrical power
consumption enables it to be used in battery-powered electronic equipment more efficiently than

General characteristics
Each pixel of an LCD typically consists of a layer of molecules aligned between
two transparent electrodes, and two polarizing filters (parallel and perpendicular), the axes of
transmission of which are (in most of the cases) perpendicular to each other. Without the liquid
crystal between the polarizing filters, light passing through the first filter would be blocked by the
second (crossed) polarizer. Before an electric field is applied, the orientation of the liquid-crystal
molecules is determined by the alignment at the surfaces of electrodes. In a twisted nematic (TN)
each pixel, light can be allowed to pass through in varying amounts thus constituting different
levels of gray. Color LCD systems use the same technique, with color filters used to generate
red, green, and blue pixels.[3]

LCD in a Texas Instruments calculator with top polarizer removed from device and placed on top, such that
the top and bottom polarizers are perpendicular. Note that colors are inverted.

The optical effect of a TN device in the voltage-on state is far less dependent on variations in the
device thickness than that in the voltage-off state. Because of this, TN displays with low information
content and no backlighting are usually operated between crossed polarizers such used. For this
purpose, TN LCDs are operated between parallel polarizers, whereas IPS LCDs feature crossed
polarizers. In many applications IPS LCDs have replaced TN LCDs, in particular in smartphones such
as iPhones. Both the liquid crystal material and the alignment layer material contain ionic compounds.
If an electric field of one particular polarity is applied for a long period of time, this ionic material is
attracted to the surfaces and degrades the device performance. This is avoided either by applying
an alternating current or by reversing the polarity of the electric field as the device is addressed (the
response of the liquid crystal layer is identical, regardless of the polarity of the applied field).

A Casio Alarm Chrono digital watch with LCD.

Displays for a small number of individual digits or fixed symbols (as in digital watches and pocket
calculators) can be implemented with independent electrodes for each segment.[4] In contrast,
full alphanumeric or variable graphics displays are usually implemented with pixels arranged as a
matrix consisting of electrically connected rows on one side of the LC layer and columns on the
other side, which makes it possible to address each pixel at the intersections. The general
method of matrix addressing consists of sequentially addressing one side of the matrix, for
example by selecting the rows one-by-one and applying the picture information on the other side
at the columns row-by-row. For details on the various matrix addressing schemes see passive-
matrix and active-matrix addressed LCDs.

You might also like