#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit beep=P2^3;
uchar aa,bb,i;
void delayms(uint);
void main()
{
aa=0xfe;
bb=0x7f;
while(1)
{
P1=aa;
beep=0;
delayms(50);
for(i=0;i<7;i++)
{
beep=1;
P1=_crol_(P1,1);
beep=0;
delayms(50);
}
beep=1;
P1=bb;
beep=0;
delayms(50);
for(i=0;i<7;i++)
{
beep=1;
P1=_cror_ (P1,1);
beep=0;
delayms(50);
}
beep=1;
}
}
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
|