Friday, June 1, 2012

How to run two 7segment display with a single port of microcontroller.

For this purpose we can alternatively display the different data at different time repetitively from same port. Since there is some delay need to turn off the glowing LED of 7 segment display so by alternative display of different data in different segments we  can show as they are continuously displaying the data.

 
I have practically applied to display two 7 segments  from 00 up to 99 through a single port, the *.c code I've created is given below:

#include<at89x51.h>
void delay(unsigned int n)
Figure:- Simulation Circuit in Protious.
{
unsigned int i,j;
for(i=0;i<n;i++)
for(j=0;j<1275;j++);
}
void main()
{
while(1)
{
int disp[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int i,j,k;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
k=40;
while(k>0)//40 times alternate display
{
P2_1=1;
P2_0=0;
P1=disp[i];
delay(1);
P2_1=0;
P2_0=1;
P1=disp[j];
delay(1);
k--;
}
}
}
}
}

No comments:

Post a Comment