Seven Segment displays are used in a number of systems to display the numeric information. The seven segment can display one digit at a time. Thus the no. of segments used depends on the no. of digits in the number to be displayed. Interfacing seven segment with a controller or MCU is tricky. This article explains the interfacing of seven segment with MCU AT89C51. It displays the digits 0 to 9 continuously at a predefined time delay.
A seven segment consists of eight LEDs which are aligned in a manner so as to display digits from 0 to 9 when proper combination of LED is switched on. Seven segment uses seven LED’s to display digits from 0 to 9 and the eighth LED is used for the dot. A typical seven segment looks like as shown in the figure below.
Fig. 2: A typical seven segment
DIGIT
|
a
|
b
|
c
|
d
|
e
|
f
|
g
|
HEX Value
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
1
|
0x40
|
1
|
1
|
0
|
0
|
1
|
1
|
1
|
1
|
0xF9
|
2
|
0
|
0
|
1
|
0
|
0
|
1
|
0
|
0x24
|
3
|
0
|
0
|
0
|
0
|
1
|
1
|
0
|
0x30
|
4
|
1
|
0
|
0
|
1
|
1
|
0
|
0
|
0x19
|
5
|
0
|
1
|
0
|
0
|
1
|
0
|
0
|
0x12
|
6
|
0
|
1
|
0
|
0
|
0
|
0
|
0
|
0x02
|
7
|
0
|
0
|
0
|
1
|
1
|
1
|
1
|
0xF8
|
8
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0x00
|
9
|
0
|
0
|
0
|
1
|
1
|
0
|
0
|
0x10
|
Project Source Code
###
// Program to interface single seven segment #include<reg51.h> delay_ms(int time) // Time delay function { int i,j; for(i=0;i<time;i++) for(j=0;j<1275;j++); } void main() { char num[]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10}; // Hex values corresponding to digits 0 to 9 int c; while(1) { for(c=0;c<10;c++) { P2=num[c]; delay_ms(200); } } }
###
Circuit Diagrams
Project Components
Project Video
Filed Under: 8051 Microcontroller
Filed Under: 8051 Microcontroller
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.