Thursday, 5 March 2015

When Switch is Pressed 7segmate start the count 0-9 using AT89S52

#include<reg52.h>
sfr LED=0x80;
sbit sw1=P1^0;
void msdelay(unsigned int);
void main()
{
unsigned int a[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
unsigned int e;
if(sw1==0)
{
for(e=0;e<10;e++)
{
LED=a[e];
msdelay(200);
}
}
}
void msdelay(unsigned int item)
{
unsigned int i,j;
for(i=0;i<=item;i++)
for(j=0;j<=1275;j++);
}

No comments:

Post a Comment