Interfacing of 7-Segment Display with 8051

Updated on 2017/08/11 11:17

 

Interfacing of 7-Segment Display with 8051

About Seven Segment Display

A seven segment display is the most basic electronic display device that can display the digits from 0-F (hexadecimal numbers). The seven segment pins (a,b,c,d,e,f,g) plus the decimal point of a common anode display are connected to port pins of LPC1768 via current limiting resistors (220 Omega). The program is developed using software to display hexadecimal numbers 0-F on the display.

Pins Configuration

7-segment-display.png      7-segment-display-1.png

Seven segment LED is device having seven light emitting diodes with either anode terminals (common anode ) or cathode terminals connected together to form a number '8' pattern as shown in the picture.

To use them you should know the pin configuration of the commercially available displays. As you must have guessed these displays should have nine pins( one for each segment + decimal point +common) but the available modules have two pins for common ground. They are internally connected. So they have total of 10 pins.

A 7-Segment display has 7-segments/pins named as a, b, c, b, e, f, g for forming the '8' pattern and and another segment/pin called 'h' for DP (decimal point) along with two extra pins for GND (in case of common cathode).

Displaying Characters

To display numbers in seven-segment display, it is necessary to define the control signals. Below table shows the segment control for characters 0-9 as required for displaying numbers.

Segment Control table for displaying characters 0 to 9
Numberhgfedcba
000111111
100000110
201011011
301001111
400110110
501101101
601111101
700000111
801111111
901101111

Video Proteus simulation


Interfacing Diagram

8051_7seg.jpg

ALP for the interfacing

Program:-Write an ALP to interface 7-segment display with 8051 microcontroller and to display numbers from 0-9

ORG 00H
START:MOV R1,#10;Count for displaying numbers from 0 to 9
MOV DPTR,#400H ;DPTR pointing at satrt address of look-up table
BACK:CLR A;A=0
MOVC A,@A+DPTR ;Load A with value present at location 400h
MOV P1,A        ;send the data to 7-segment display
ACALL DELAY  ; call delay
INC DPTR     ; increment DPTR
DJNZ R1,BACK  ;Decrement R1 by 1 and repeat until becomes 0
SJMP START  
ORG 400H
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
DELAY:MOV R2,#08H
UP2:MOV R4,#0FFH
UP1:MOV R3,#0FFH
HERE:DJNZ R3,HERE
DJNZ R4,UP1
DJNZ R2,UP2
RET
END

References

  • Created and developed by Prof S.M.Wagh , SKNCOE and Prof.H.Lokhande, Sinhgad's NBNSTIC, Pune
  • Interfacing diagram by Jayesh Gopal, Wikinote volunteer, SKNCOE
  • WikiNote Foundation
Tags:
Created by Sujit Wagh on 2017/08/03 10:46