/*
8个按键发出8个基本音,
能播放内置音乐,音乐跟随灯光闪烁
*/
#include
#define uint unsigned int
#define uchar unsigned char
sbit speaker=P1^4;//喇叭接30脚
sbit key1=P1^0;//流水灯按键(暂时)
sbit key2=P1^1;//播放音乐按键(暂定)
uchar a,b,num1,s1num,n1,n2;
uchar qushu=0;
char num;//定义num为可以负数
uchar code yinfu[]={0xfb,0xe9, //Do
0xfc,0x5c, //Re
0xfc,0xc1, //Mi
0xfc,0xef, //Fa
0xfd,0x45, //So
0xfd,0x92, //La
0xfd,0xd0, //Si
0xfd,0xee, //Do#
0x00,0x00, //间隔
};
uchar code shengri_tone[]={ 1,0,1,2,1,4,3,0, //生日快乐音调
1,0,1,2,1,5,4,0,
1,0,1,8,6,4,3,2,0,
7,0,7,6,4,5,4,0 //0代表不发声,即停顿;数字即为音调
};
uchar code laohu_tone[]={1,2,3,1,0,1,2, //两只老虎乐谱