Shopping Cart

0 item(s) - Rs.0.00
Your shopping cart is empty!
Please update your Flash Player to view content.

. . . FOLLOW  US







 
 
Interfacing 7-Seg Display to Microcontroller
Tutorial - 8051 Tutorial
Written by Amol Shah   

7 Seg displays are are basically 7 LED's. It will be much easier to understand if you first read Interfacing LED's to Microcontroller.

 

CACC

Basically there are two types of 7-Seg display's:

  1. Common Cathode where all the segments share the same Cathode.
  2. Common Anode where all Segments share the same Anode.

Here we will be only discussing the Common Anode type.In common Anode in order to turn ON a segment the corresponding pin must be set to 0. And to turn it OFF it is set to 1.

7_segment__pin_configuration
7_seg_circuit_ca
lookup
Figure 2
Controller 7-seg display
P2.0 A
P2.1 B
P2.2 C
P2.3 D
P2.4 E
P2.5 F
P2.6 G
Figure 1 shows how to interface 7-seg display to a microcontroller. Now we create a lookup table containing the seven segment pattern to display the corresponding hex digits. e.g. consider we have to display '1' from the above figure  we come to know that turning ON segment B & C will show '1' on the 7-seg display so P2.1 & P2.2 should be LOGIC 0 whereas rest of the pins should be LOGIC 1. FIGURE 2 shows the lookup table for CA display.
2X7seg
Figure 3

We can now interface a single 7-Seg to the microcontroller but for interfacing multiple 7-seg's we use Scanning Principle where One 7-seg is displayed after another but this process is very fast hence the flickering cannot be seen by human eye. Figure 3 shows the circuit for interfacing two 7 seg displays.

7segment_display

When interfacing more than one 7-seg display the segment's (A-G) of all displays are connected together  whereas their ANODE (Cathode in case of CC displays) are switched ON one after another. Consider we have to display '31' on the above 7-seg display so we TURN ON the first transistor by setting its corresponding pin to 1 & then give the 7-seg equivalent code for '3' which is 4fh. Then we TURN OFF the first transistor & TURN ON the second & output its corresponding 7-seg equivalent code of '1' i.e. 06h.Then we again go back to display '3' this is a never ending loop.

ORG 0000h

CLR P3.0

CLR P3.1

MOV P2,#0ffh

loop:
CLR P3.0

SETB P3.1

MOV P2,#4fh

CALL delay

CLR P3.1

SETB P3.0

mov P2,#06h

CALL delay

AJMP loop

.

 
 

Featured

Latest

EEPROM 24C64
Rs.35.00
EEPROM 24C512
Rs.90.00
EEPROM 24C32
Rs.25.00
EEPROM 24C256
Rs.75.00
 
 
 
.
 TUTORIALS
.
  8051 Tutorial
 
  Power Supply
 
CODE LIBRARY
.

  8051 Assembly
 
  C Code Library
 

.
 PROJECTS
.
  Project List
 
  Synopsis and Abstract
 
DOWNLOADS
.

  Datasheets
 
  Download
 

.
 POPULAR
.
  About Us
 
  DNA Shop
 
  Totorial
 
  Code Library
 
  Download
 

.
CONTACT US
.

Mr. Amol Shah

DNA Technology Nashik,

Maharashtra 422009 India

Phone : 0253-3023939

Mobile : 09225145135

Email : contact@dnatechindia.com