#include
#define uchar unsigned char
#define uchar unsigned char
#define uint unsigned int
#define LCDPORT P0
uchar code tab[]="Press key";
uchar code tab1[]="Select song";
uchar code tab2[]="First Song" ;
uchar code tab3[]="butterfly";
uchar code tab4[]="Second Song" ;
uchar code tab5[]="Jingle bell ";
uchar code tab6[]="Third Song" ;
uchar code tab7[]="Yesterday";
uchar code tab8[]="Forth Song" ;
uchar code tab9[]="Youth League";
sbit LCDE=P2^2;
sbit LCDRW=P2^1;
sbit LCDRS=P2^0;
#define SYSTEM_OSC 12000000 //定义晶振频率12000000HZ
#define SOUND_SPACE 4/5 //定义普通音符演奏的长度分率,//每4分音符间隔
sbit BeepIO = P3^7; //定义输出管脚
sbit K1=P1^7;
unsigned int code FreTab[12] = { 262,277,294,311,330,349,369,392,415,440,466,494 }; //原始频率表
unsigned char code SignTab[7] = { 0,2,4,5,7,9,11 }; //1~7在频率表中的位置
unsigned char code LengthTab[7]= { 1,2,4,8,16,32,64 };
unsigned char Sound_Temp_TH0,Sound_Temp_TL0; //音符定时器初值暂存
unsigned char Sound_Temp_TH1,Sound_Temp_TL1;
unsigned char code Music_Girl[]=
{ 0x1B,0x02, 0x1A,0x02, 0x1B,0x02, 0x19,0x66, 0x1A,0x03,
0x18,0x02, 0x17,0x02, 0x16,0x0D, 0x17,0x03, 0x18,0x0D,
0x17,0x03, 0x19,0x66, 0x17,0x03, 0x16,0x0D, 0x17,0x03,
0x19,0x0D, 0x16,0x03, 0x17,0x0D, 0x18,0x03, 0x17,0x0D,
0x16,0x03, 0x15,0x00, 0x19,0x02, 0x11,0x02, 0x16,0x02,
0x10,0x02, 0x15,0x02, 0x0F,0x00, 0x10,0x03, 0x15,0x03,
0x0F,0x00, 0x0D,0x01, 0x0F,0x66, 0x10,0x03, 0x15,0x66,
0x16,0x03, 0x10,0x0D, 0x15,0x03, 0x0F,0x03, 0x19,0x66,
0x1F,0x03, 0x1A,0x0D, 0x19,0x03, 0x17,0x03, 0x19,0x03,
0x16,0x00, 0x16,0x66, 0x17,0x03, 0x11,0x0C, 0x10,0x02,
0x19,0x66, 0x10,0x03, 0x15,0x02, 0x16,0x02, 0x0D,0x02,
0x15,0x02, 0x10,0x0D, 0x0F,0x03, 0x10,0x0D, 0x15,0x03,
0x0F,0x00, 0x17,0x66, 0x19,0x03, 0x11,0x02, 0x16,0x02,
0x10,0x0D, 0x15,0x03, 0x0F,0x15, 0x0D,0x03, 0x0F,0x02,
0x0D,0x03, 0x0F,0x0D, 0x10,0x03, 0x11,0x0D, 0x16,0x03,
0x10,0x00, 0x0F,0x0D, 0x10,0x03, 0x15,0x66, 0x16,0x03,
0x19,0x02, 0x17,0x02, 0x16,0x02, 0x17,0x0D, 0x16,0x03,
0x15,0x02, 0x10,0x0D, 0x0F,0x03, 0x0D,0x01, 0x15,0x01,
0x10,0x03, 0x15,0x04, 0x10,0x0D, 0x0F,0x03, 0x0D,0x0D,
0x0F,0x03, 0x10,0x0D, 0x15,0x03, 0x0F,0x00, 0x17,0x0D,
0x19,0x03, 0x16,0x0D, 0x17,0x03, 0x16,0x0D, 0x15,0x03,
0x11,0x02, 0x10,0x02, 0x0F,0x00, 0x00,0x00 };
unsigned char code Music_Jingle[]={
0x0F,0x03, 0x0F,0x03, 0x17,0x03, 0x16,0x03, 0x15,0x03,
0x0F,0x66, 0x19,0x04, 0x19,0x04, 0x0F,0x03, 0x17,0x03,
0x16,0x03, 0x15,0x03, 0x10,0x02, 0x10,0x03, 0x10,0x03,
0x18,0x03, 0x17,0x03, 0x16,0x03, 0x10,0x66, 0x10,0x03,
0x19,0x03, 0x19,0x03, 0x18,0x03, 0x16,0x03, 0x17,0x02,
0x15,0x03, 0x0F,0x03, 0x0F,0x03, 0x17,0x03, 0x16,0x03,
0x15,0x03, 0x0F,0x66, 0x0F,0x03, 0x0F,0x03, 0x17,0x03,
0x16,0x03, 0x15,0x03, 0x10,0x66, 0x10,0x03, 0x10,0x03,
0x18,0x03, 0x