7 Segment LED display C program using 8051 AT89S52 self learning developer kit

This is a simple program on interfacing 7 segment LED display with 8051 AT89S52. In this program we will just move 0x07 to P1 port in AT89S52.  Which means 7 segment LED will display Number 7.

Hardware Connection:



P1_0 to A
P1_1 to B
P1_2 to C
P1_3 to E
P1_4 to F
P1_5 to G
P1_6 to DEC

0 to +5v

Program:

#include<at89x52.h>
void main() {
P1 = 0x07;
}

Explanation:

In the main function we are just assigning 0x07 to Pos=rt 1.

Hex value for 0 - 9 digits

Digit
Dp
g
f
e
d
c
b
a
Hex value
0
0
0
1
1
1
1
1
1
0x3f
1
0
0
0
0
0
1
1
0
0x06
2
0
1
0
1
1
0
1
1
0x5b
3
0
1
0
0
1
1
1
1
0x4f
4
0
1
1
0
0
1
1
0
0x66
5
0
1
1
0
1
1
0
1
0x6d
6
0
1
1
1
1
1
0
1
0x7d
7
0
0
0
0
0
1
1
1
0x07
8
0
1
1
1
1
1
1
1
0x7f
9
0
1
1
0
0
1
1
1
0x67

Output:



Cheers!!!!
-> Let Us Embed <-