LED, LCD, and 7 – Segment Display
Display Using LED:
Light emitting diode (LED) is the most commonly used device for displaying the status of
microcontroller pins. These display devices are commonly used for the indication of
alarms, inputs and timers. There are two ways by we can connect LEDs to microcontroller
unit. Those two ways are active high logic and active low logic. Active high logic means
LED will be ON when port pin is 1 and LED will be OFF when pin is 0. Active low means
LED will be OFF when port pin is 1 and LED will be ON when port pin is 0.
Dot Matrix LED Display:
Dot matrix LED display contains the group of LEDs as a two-dimensional array. They can
display different types of characters or a group of characters. Dot matrix display is
manufactured in various dimensions. Arrangement of LEDs in the matrix pattern is made
in either of the two ways: Row anode-column cathode or Row cathode-column anode. By
using this dot matrix display we can reduce the number of pins required for controlling all
the LEDs.
A dot matrix is a two-dimensional array of dots used to represent characters, symbols
and messages. Dot matrix is used in displays. It is a display device used to display
information on many devices like machines, clocks, railway departure indicators etc.
An LED dot matrix consists of an array of LED’s which are connected such that the anode
of each LED are connected together in the same column and the cathode of each LED
are connected together in the same row or vice versa. An LED dot matrix display can also
come with multiple LEDs of varying colors behind each dot in the matrix like red, green,
blue etc.
Here each dot represents circular lenses in front of LEDs. This is done to minimize the
number of pins required to drive them. For example, an 8X8 matrix of LEDs would need
64 I/O pins, one for each LED pixel. By connecting all the anodes of LEDs together in a
column and all the cathodes together in row, the required number of input and output pins
reduced to 16. Each LED will be addressed by its row and column number.
Diagram of 8X8 LED Matrix using 16 I/O pins
Diagram of 8X8 LED Matrix
using 16 I/O pins
Controlling the LED Matrix:
Since all the LEDs in a matrix share their positive and negative terminals in each row and
column, it is not possible controlling of each LED at the same time. The matrix controlled
through each row very quickly by triggering the correct column pins to light the desired
LED’s for that particular row. If the switching done with a fixed rate, humans can’t see the
displaying message, because human eye can’t detect the images with in the milliseconds
of time. Thus, the displaying of a message on LED matrix must be controlled, with the
rows being scanned sequentially at a rate greater than 40 MHz while sending out the
column data at the exact same rate. This kind of controlling can be done my interfacing
the LED matrix display with the microcontroller.
Interfacing the LED Matrix Display with Microcontroller:
Choosing a microcontroller for interfacing with LED matrix display which is to be controlled
is depends on the number of input and output pins needed for controlling all the LEDs in
the given matrix display, the amount of current that each pin can source and sink and the
speed at which the microcontroller can send out control signals. With all these
specifications, interfacing can be done for LED matrix display with a microcontroller.
Using 12 I/O pins controlling the Matrix display of 32 LEDs
12 I/O pins
controlling the Matrix display of 32 LEDs
In the above diagram each seven-segment display is having 8 LEDs. Hence the total
number of LEDs is 32. For controlling all the 32 LEDs 8 information lines and 4 control
lines are needed i.e. for displaying message on the matrix of 32 LEDs, 12 lines are
needed when they are connected in matrix notation. Using the microcontroller instructions
can be converted into signals which turn ON or OFF lights in the matrix. Then the required
message can be displayed. By controlling with the microcontroller, we can change which
color LEDs are lit at even intervals.
There are several options for choosing microcontroller and LED matrix. The easiest way
is first choosing the LED dot matrix and then selecting a microcontroller which needs the
requirements of LEDs to be controlled. Once these selections are completed, a major part
is lies in programming to scan the columns and feed the rows with appropriate values for
the LED matrix to display different patterns for displaying required message.
Liquid Crystal Display (LCD):
Liquid crystal display (LCD) has material which joins together the properties of both liquid
and crystals. They have a temperature range within which the particles are essentially as
mobile as they might be in a liquid, however are gathered together in an order form similar
to a crystal.
The LCD is much more informative output device than a single LED. The LCD is a display
that can easily show characters on its screen. They have a couple of lines to large
displays. Some LCDs are specially designed for specific applications to display graphic
images. 16×2 LCD (HD44780) module is commonly used. These modules are replacing
7-segments and other multi-segment LEDs. LCD can be easily interfaced with
microcontroller to display a message or status of the device. It can be operated in two
modes: 4-bit mode and 8-bit mode. This LCD has two registers namely command register
and data register. It is having three selection lines and 8 data lines. By connecting the
three selection lines and data lines with the microcontroller, the messages can be
displayed on LCD.
LCD instructions set for controlling the LCD display using microcontrollers Interfacing 16×2 LCD display
with 8051 microcontrollers.
In the above figure 3 selected lines EN, R/W, RS will be used for controlling the LCD
display. EN pin will be used for enabling the LCD display for communicating with
microcontroller. RS will be used for register selection.
When RS is set microcontroller will send instructions as data and when RS is clear
microcontroller will send the instructions as commands. For writing data RW should be 0
and for reading RW should be 1.
LC
PIN Description
Interfacing 16×2 LCD with Microcontroller:
Many microcontroller devices are using smart LCD displays to output visual information.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. A 4-bit data bus
requires supply line as well as 7 extra lines. When the LCD display is not enabled, data
lines are tri-stated which means they are in a state of high impedance and this means
they do not interfere with the microcontroller operation when display is not used.
The three control lines are referred to as EN, RS and RW.
• The EN (Enable) control line is used to send the data to the LCD. A high to low transition at this pin
will enable the module.
• When RS or Register Select is low, the data is to be treated as a command instruction. When RS is high,
the data being sent is displayed on the screen. For Instance, to display any character on the screen, we
set RS high.
• When RW or Read/Write Control line is low, the information on the data bus is being written to the
LCD. When RW is high, the program is effectively reading the LCD. RW line will always be low.
The data bus consists of 4 or 8 lines; it depends on the mode of operation selected by
the user. The lines of an 8 bit data bus are referred to as DB0,DB1,DB2,DB3,DB4,DB5,
DB6 and DB7.
Comparison Chart
Basis for
LED LCD
Comparison
Definition PN-Junction device which It is an optical device used
discharge visible lights for displaying the
when an electrical charge information in the form of
passes through it. text and images.
Basis for
LED LCD
Comparison
Stand For Light Emitting Diode Liquid Crystal Display
Backlight No backlight Cold cathode fluorescent
lamp provides backlight.
Resolution High Low
Power More Less
Requirement
Display Area Small Large
Cost High Low
Material Gallium arsenide Liquid crystals and glass
phosphide. electrodes.
Switching Time Fast Slow
Direct Current Do not effects. Reduces Life Span
Contrast Ratio Low High
Mercury Not used Used
BCD to 7 Segment Display
A seven-segment display is an electronic display device for displaying decimal numerals. Seven-segment
displays are widely used in digital clocks, electronic meters and other electronic devices that display
numerical information.
7 Segment Display
A 7 Segment LED display generally has 8 input connections, one for each LED segment and one that acts
as a common terminal. There are 2 types of 7 Segment LED digital display.
Common Cathode Display – all the cathode connections of the LEDs are connected to ground. A logic '1'
applied to the anode terminal of the individual segment illuminates it.
Common Anode Display – all the anode connections of the LEDs are connected to VCC. A logic '0' applied
to the cathode terminal of the individual segment illuminates it.
BCD to 7 Segment Display Decoder
A BCD to Seven Segment decoder is a combinational logic circuit that accepts a decimal digit in BCD
(input) and generates appropriate outputs for the segments to display the input decimal digit.
The truth table is extracted from the CD4511 IC datasheet. This truth table is interactive. Click on any
row to see the respective 7 segment display output.
Truth Table
Display D C B A a b c d e f g
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
Blank 1 0 1 0 0 0 0 0 0 0 0
Blank 1 0 1 1 0 0 0 0 0 0 0
Blank 1 1 0 0 0 0 0 0 0 0 0
Blank 1 1 0 1 0 0 0 0 0 0 0
Blank 1 1 1 0 0 0 0 0 0 0 0
Blank 1 1 1 1 0 0 0 0 0 0 0
The input bits are D (MSB) to A (LSB) and the outputs are the segments a to g. For input values A to F,
the display is blanked (outputs are all 0).
The logic circuit to implement the BCD to 7 Segment Decoder can be designed using the truth table