7 segment LED display 0 to 9 using 8051 AT89S59 self learning development board - Video tutorial

Here We are going to interface 7 segment LED display to 8051 AT89S59. Then we will be displaying 0 to 9 aka it will start to count 0 to 9.

Hardware Connections:


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 +5

Program:  

#include<at89x52.h>
int a = 100;
int i;
unsigned char displayValue[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
void delay() {
while(a--);
}
void main() {
while(1) {
for(i=0;i<10;i++) {
delay();
P1 = displayValue[i];
}
}
}

Explanation:

Delay function:

This will give some delay.
Need more explanation on delay function.

Main Loop:

As we know basic concept of displaying values in 7 segment LED display.
The algorithm for this 0 to 9 counting program is with delay and for loop.

Inside super loop,

for loop will be executed 10 times first it will give some delay. Then i'th value of displayValue array is assigned to Port 1 so we can see 0 to 9 is counting.

How displayValue array is initialized with hex values.

Working Video:

Will be available soon !! :)

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