#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit beep = P2^3;
uchar i;
uchar temp;
void delay(uint z)
{
uint x,y;
for(x = z; x > 0; x--)
for(y = 120; y > 0 ; y--);
}
void main()
{
temp = 0x7f;
while(1)
{
for(i = 0; i < 8; i++)
{
P1 = temp;
beep = ~beep;
temp = _cror_(temp,1);
delay(500);
}
}
}
|