#include<reg52.h>
sbit beep=P1^5;
#define uint unsigned int
#define uchar unsigned char
uint code high[]={0xf8,0xf9,0xfa,0xfa,0xfb,0xfb,0xfc};
uint code low[]={0x89,0x5b,0x15,0x67,0x04,0x90,0x0c};
uint i=0;
uint m=0;
void init()
{
TMOD=0x01;
EA=1;
ET0=1;
}
void main()
{
init();
while(m%2==0)
{
TH0=high[i];
TL0=low[i];
TR0=1;
}
}
void t0()interrupt 1
{
TH0=high[i];
TL0=low[i];
beep=~beep;
m++;
if(m%2==0)
i++;
if(i>7)
i=0;
} |