#include<reg52.h>
sbit SPK=P2^7;
unsigned char data T0_L,T0_H;
unsigned int code table1[]={64021,64103,64260,64400,64524,64580,64684,64777,64820,64898,64968,65030,64934};
unsigned char code table[]={0x42,0x82,0x82,0x82,0x84,0x02,0x72,0x62,0x72,0x62,0x520x48,0xb2,0xb2,0xb2,0xb2,0xb4,0x02,0xa2,0x12,0xa2,0xd2,0x92,0x88,0x82,0xb2,0xb2,0xa2,0x84,0x02,0x72,0x62,0x72,0x62,0x52,0x44,0x02,0x12,0x12,0x62,0x62,0x52,0x44,0x02,0x82,0x72,0x62,0x52,0x32,0x48,0x00};
void delay(unsigned char N)
{ unsigned int i;
while(N--) for(i=0;i<16000;i++);}
void tim0() interrupt 1
{ TL0=T0_L;TH0=T0_H;SPK=~SPK;}
void main()
{ unsigned char i,j;
TMOD=0X01;IE=0X82;
while(1)
{ i=0;
while(table[i]!=0)
{ j=(table[i]>>4)&0x0f;
if(j!=0)
{j--;
T0_H=table1[j]/256;TH0=T0_H;
T0_L=table1[j]%256;TL0=T0_L;
TR0=1;}
else TR0=0;
delay((table[i]&0x0f)/1);
i++;}
TR0=0;}}
|