51单片机播放10首歌
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
0xB2,0xB2,0xB2,0xB6,0xA2,0x83,0xA1,0xA2,0x92,0x88,0x82,0xB2,
0xB2,0xA2,0x86,0x72,0x63,0x71,0x62,0x52,0x44,0x12,0x02,0x12,
0x62,0x62,0x52,0x46,0x82,0x73,0x61,0x52,0x32,0x48,0x00,0xff};
uchar code song_name10[18]={0xc7,0xfa,0xc4,0xbf,0xca,0xae,0xa1,0xc3,0xc0,0xbc,0xbb,0xa8,0xb2,0xdd,0xff};//兰花草
uchar code song10[]={0x42,0x82,0x82,0x82,0x86,0x72,0x63,0x71,0x62,0x52,0x48,0xB2,
0xfe,0x2a,0xfe,0x5c,0xfe,0x84,0xfe,0x98,0xfe,0xc0,0xfe,0xe8,0xfe,0x06,0xff};
//两只老虎
uchar code song1[]={0x44,0x54,0x64,0x44,0x44,0x54,0x64,0x44,0x64,0x74,0x88,0x64,
0x74,0x88,0x82,0x92,0x82,0x72,0x64,0x44,0x82,0x92,0x82,0x72,
0x64,0x44,0x54,0x14,0x48,0x54,0x14,0x48,0xff};
//新年快乐
uchar code song2[]={0x42,0x42,0x44,0x14,0x02,0x62,0x62,0x64,0x44,0x04,0x42,0x62,
void delay_song(); /* 延时128ms */
void delay(int i); /* 延时 */
void KeyScan(); /* 键盘扫描函数 */
uchar zz;
0x72,0x82,0xA2,
0x82,0x72,0x62,0x42,0x62,0x38,0x38,0xA4,0x02,
0xB2,0xA4,0x84,0x72,0x82,0x72,0x62,0x72,0x84,0x72,0x64,0x62,
#define uchar unsigned char
#define uint unsigned int
uchar code * song;
uchar code * song_name;
uchar code * song_lrc;
uchar table[10]={'0','1','2','3','4','5','6','7','8','9'};
void delay_song(void) /*延时128ms*/
{
uint count111=140;
unsigned int i,j;
for(i=0;i<count111;i++)
for(j=0;j<120;j++);
}
void delay(int i) /*延时*/
0x84,0xC4,0xB4,0x04,0x82,0x01,0x81,0xF4,0xD4,0xB4,0xA4,0x94,
0x04,0xE2,0x01,0xE1,0xD4,0xB4,0xC4,0xB4,0x04,0xff};
//梁祝
uchar code song5[]={0xA2,0xB2,0xD2,0xB2,0xA4,0xB2,0xD2,0xB2,0xA2,0x82,0x72,0x88,
unsigned char bdata status;
uchar COUNT_1=0,count=0,yimiao=0,j,i;
sbit Sing=P2^7; /*P3口接蜂鸣器,输出方波 */
sbit E=P2^2;
sbit RW=P2^1;
sbit RS=P2^0;
0xB2,0xA2,0x86,0x72,0x63,0x71,0x62,0x52,0x44,0x12,0x,0x46,0x82,0x73,0x61,0x52,0x32,0x48,0x00,0xff};
//记事本
uchar code song7[]={0x84,0x82,0x82,0x82,0xB2,0xB2,0x82,0xC2,0xC3,0x82,0x84,0xB2,
0x10,0x06,0x20,0x00,0x08,0x08,0x08,0x09,0x08,0x0A,0x08,0x0C,0x18,0x00,0x01,0x0C,0x08,0x0D,0x10,0x09,0x10,0x0A,0x30,0x00,0x01,0x0A,0x08,0x0C,0x08,0x0D,0x20,0x0C,0x18,0x0D,0x08,0x0F,0x08,0x0E,0x04,0x0D,0x04,0x0C,0x08,0x0D,0x08,0x0A,0x10,0x00,0x04,0x08,0x08,0x09,0x08,0x0A,0x18,0x0C,0x08,0x08,0x10,0x06,0x10,0x08,0x08,0x09,0x08,0x0A,0x08,0x0D,0x08,0x0C,0x30,0x00,0x10,0x0A,0x20,0x0D,0x18,0x00,0x01,0x0D,0x08,0x0C,0x08,0x0B,0x08,0x0A,0x10,0x00,0x01,0x09,0x20,0x0A,0x18,0x0C,0x08,0x06,0x08,0x08,0x08,0x09,0x10,0x00,0x10,0x08,0x08,0x09,0x08,0x0A,0x10,0x0C,0x0B,0x00,0x01,0x0C,0x04,0x0D,0x10,0x0F,0x10,0x0E,0x08,0x0D,0x08,0x0C,0x08,0x0A,0x08,0x0D,0x40 ,0x00,0x01,0xff};
{
int j,k;
for(j=0;j<i;j++)
{
k=0x0f;
while(k--);
}
}
void Delay_Ms(uint x)//1ms
{
uint g,k;
for(g=0;g<x;g++)
for(k=0;k<=120;k++);
uchar code tab[]={0xf8,0x94,0xf9,0x5c,0xfa,0x1a,0xfa,0x6a,0xfb,0x00,0xfb,0x8c,0xfc,0x0e,
0xfc,0x4a,0xfc,0xae,0xfd,0x08,0xfd,0x30,0xfd,0x80,0xfd,0xc6,0xfe,0x02,
unsigned char code init[]={0xB0,0xB4,0xBC,0xFC,0xD1,0xA1,0xD4,0xF1,0xB8,0xE8,0xC7,
0xFA,0x20,0x20,0x20,0x20,0xff};
//unsigned char code qingling[]={0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xff};
0x12,0x34,0x02,0x42,0x38,0x38,0x44,0x02,0x32,0x44,0x64,0x72,
0x82,0x72,0x62,0x72,0x84,0xA2,0x72,0xff};
//让我们荡起双桨
uchar code song9[]={0x06,0x08,0x08,0x08,0x09,0x08,0x0A,0x18,0x0C,0x08,0x0A,0x08,0x08,0x08,0x09,
0x12,0x12,0x32,0x42,0x54,0x44,0x4F,0xC4,0x12,0x32,0x44,0x42,
0x72,0x58,0x42,0x32,0x34,0x14,0x12,0x32,0x34,0x12,0x1F,0xff};
//星星索
uchar code song4[]={0x82,0x01,0x81,0x94,0x84,0xB4,0x04,0x04,0x82,0x01,0x81,0x94,
0xC3,0x83,0x04,0x84,0xB2,0xA2,0xA2,0x93,0x94,0x82,0x92,0x82,
0x63,0x04,0x52,0x62,0x52,0x62,0x44,0x04,0xff};
//绿岛小夜曲
uchar code song8[]={0xA2,0xB2,0xD2,0xB2,0xA4,0xB2,0xD2,0xB2,0xA2,0x82,0x72,0x88,
0x72,0x82,0xA2,0x82,0x72,0x62,0x42,0x62,0x38,0x38,0xA4,0x02,
0xB2,0xA4,0x84,0x72,0x82,0x72,0x62,0x72,0x84,0x72,0x64,0x62,
0x12,0x34,0x02,0x42,0x38,0x38,0x44,0x02,0x32,0x44,0x64,0x72,
uchar data flag;
uchar data stl0;
uchar data sth0;
uchar data l;
uchar data k;
uchar data key;
uchar data t;
uchar data n;
uchar Key_Value=0xff;
unsigned char bdata key;
#include <reg52.h>
#include <absacc.h>
#include <math.h>
#include<intrins.h>
0x82,0x72,0x62,0x72,0x84,0xA2,0x72,0xff };
//同一首歌
uchar code song6[]={0x42,0x82,0x82,0x82,0x86,0x72,0x63,0x71,0x62,0x52,0x48,0xB2,
0xB2,0xB2,0xB2,0xB6,0xA2,0x83,0xA1,0xA2,0x92,0x88,0x82,0xB2,
0x84,0x84,0x02,0x72,0x62,0x54,0x04,0x52,0x62,0x74,0x74,0x02,
0x62,0x52,0x64,0x44,0x04,0x42,0x62,0x54,0x14,0x02,0x32,0x52,
0x44,0x04,0xff};
//生日快乐
uchar code song3[]={0xC4,0x12,0x32,0x44,0x42,0x52,0x52,0x44,0x32,0x32,0x12,0x14,
0xA2,0xA2,0x93,0x04,0x94,0x92,0x82,0x82,0x63,0x62,0x62,0x52,
0x52,0x42,0x44,0x04,0x62,0x52,0x52,0x42,0x84,0x04,0x92,0x82,
0x94,0x82,0x63,0x04,0x84,0x82,0x82,0x82,0xB2,0xB2,0x82,0xC2,
0xB2,0xA2,0x86,0x72,0x63,0x71,0x62,0x52,0x44,0x12,0x02,0x12,
0x62,0x62,0x52,0x46,0x82,0x73,0x61,0x52,0x32,0x48,0x00,0xff};
uchar code song_name10[18]={0xc7,0xfa,0xc4,0xbf,0xca,0xae,0xa1,0xc3,0xc0,0xbc,0xbb,0xa8,0xb2,0xdd,0xff};//兰花草
uchar code song10[]={0x42,0x82,0x82,0x82,0x86,0x72,0x63,0x71,0x62,0x52,0x48,0xB2,
0xfe,0x2a,0xfe,0x5c,0xfe,0x84,0xfe,0x98,0xfe,0xc0,0xfe,0xe8,0xfe,0x06,0xff};
//两只老虎
uchar code song1[]={0x44,0x54,0x64,0x44,0x44,0x54,0x64,0x44,0x64,0x74,0x88,0x64,
0x74,0x88,0x82,0x92,0x82,0x72,0x64,0x44,0x82,0x92,0x82,0x72,
0x64,0x44,0x54,0x14,0x48,0x54,0x14,0x48,0xff};
//新年快乐
uchar code song2[]={0x42,0x42,0x44,0x14,0x02,0x62,0x62,0x64,0x44,0x04,0x42,0x62,
void delay_song(); /* 延时128ms */
void delay(int i); /* 延时 */
void KeyScan(); /* 键盘扫描函数 */
uchar zz;
0x72,0x82,0xA2,
0x82,0x72,0x62,0x42,0x62,0x38,0x38,0xA4,0x02,
0xB2,0xA4,0x84,0x72,0x82,0x72,0x62,0x72,0x84,0x72,0x64,0x62,
#define uchar unsigned char
#define uint unsigned int
uchar code * song;
uchar code * song_name;
uchar code * song_lrc;
uchar table[10]={'0','1','2','3','4','5','6','7','8','9'};
void delay_song(void) /*延时128ms*/
{
uint count111=140;
unsigned int i,j;
for(i=0;i<count111;i++)
for(j=0;j<120;j++);
}
void delay(int i) /*延时*/
0x84,0xC4,0xB4,0x04,0x82,0x01,0x81,0xF4,0xD4,0xB4,0xA4,0x94,
0x04,0xE2,0x01,0xE1,0xD4,0xB4,0xC4,0xB4,0x04,0xff};
//梁祝
uchar code song5[]={0xA2,0xB2,0xD2,0xB2,0xA4,0xB2,0xD2,0xB2,0xA2,0x82,0x72,0x88,
unsigned char bdata status;
uchar COUNT_1=0,count=0,yimiao=0,j,i;
sbit Sing=P2^7; /*P3口接蜂鸣器,输出方波 */
sbit E=P2^2;
sbit RW=P2^1;
sbit RS=P2^0;
0xB2,0xA2,0x86,0x72,0x63,0x71,0x62,0x52,0x44,0x12,0x,0x46,0x82,0x73,0x61,0x52,0x32,0x48,0x00,0xff};
//记事本
uchar code song7[]={0x84,0x82,0x82,0x82,0xB2,0xB2,0x82,0xC2,0xC3,0x82,0x84,0xB2,
0x10,0x06,0x20,0x00,0x08,0x08,0x08,0x09,0x08,0x0A,0x08,0x0C,0x18,0x00,0x01,0x0C,0x08,0x0D,0x10,0x09,0x10,0x0A,0x30,0x00,0x01,0x0A,0x08,0x0C,0x08,0x0D,0x20,0x0C,0x18,0x0D,0x08,0x0F,0x08,0x0E,0x04,0x0D,0x04,0x0C,0x08,0x0D,0x08,0x0A,0x10,0x00,0x04,0x08,0x08,0x09,0x08,0x0A,0x18,0x0C,0x08,0x08,0x10,0x06,0x10,0x08,0x08,0x09,0x08,0x0A,0x08,0x0D,0x08,0x0C,0x30,0x00,0x10,0x0A,0x20,0x0D,0x18,0x00,0x01,0x0D,0x08,0x0C,0x08,0x0B,0x08,0x0A,0x10,0x00,0x01,0x09,0x20,0x0A,0x18,0x0C,0x08,0x06,0x08,0x08,0x08,0x09,0x10,0x00,0x10,0x08,0x08,0x09,0x08,0x0A,0x10,0x0C,0x0B,0x00,0x01,0x0C,0x04,0x0D,0x10,0x0F,0x10,0x0E,0x08,0x0D,0x08,0x0C,0x08,0x0A,0x08,0x0D,0x40 ,0x00,0x01,0xff};
{
int j,k;
for(j=0;j<i;j++)
{
k=0x0f;
while(k--);
}
}
void Delay_Ms(uint x)//1ms
{
uint g,k;
for(g=0;g<x;g++)
for(k=0;k<=120;k++);
uchar code tab[]={0xf8,0x94,0xf9,0x5c,0xfa,0x1a,0xfa,0x6a,0xfb,0x00,0xfb,0x8c,0xfc,0x0e,
0xfc,0x4a,0xfc,0xae,0xfd,0x08,0xfd,0x30,0xfd,0x80,0xfd,0xc6,0xfe,0x02,
unsigned char code init[]={0xB0,0xB4,0xBC,0xFC,0xD1,0xA1,0xD4,0xF1,0xB8,0xE8,0xC7,
0xFA,0x20,0x20,0x20,0x20,0xff};
//unsigned char code qingling[]={0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xff};
0x12,0x34,0x02,0x42,0x38,0x38,0x44,0x02,0x32,0x44,0x64,0x72,
0x82,0x72,0x62,0x72,0x84,0xA2,0x72,0xff};
//让我们荡起双桨
uchar code song9[]={0x06,0x08,0x08,0x08,0x09,0x08,0x0A,0x18,0x0C,0x08,0x0A,0x08,0x08,0x08,0x09,
0x12,0x12,0x32,0x42,0x54,0x44,0x4F,0xC4,0x12,0x32,0x44,0x42,
0x72,0x58,0x42,0x32,0x34,0x14,0x12,0x32,0x34,0x12,0x1F,0xff};
//星星索
uchar code song4[]={0x82,0x01,0x81,0x94,0x84,0xB4,0x04,0x04,0x82,0x01,0x81,0x94,
0xC3,0x83,0x04,0x84,0xB2,0xA2,0xA2,0x93,0x94,0x82,0x92,0x82,
0x63,0x04,0x52,0x62,0x52,0x62,0x44,0x04,0xff};
//绿岛小夜曲
uchar code song8[]={0xA2,0xB2,0xD2,0xB2,0xA4,0xB2,0xD2,0xB2,0xA2,0x82,0x72,0x88,
0x72,0x82,0xA2,0x82,0x72,0x62,0x42,0x62,0x38,0x38,0xA4,0x02,
0xB2,0xA4,0x84,0x72,0x82,0x72,0x62,0x72,0x84,0x72,0x64,0x62,
0x12,0x34,0x02,0x42,0x38,0x38,0x44,0x02,0x32,0x44,0x64,0x72,
uchar data flag;
uchar data stl0;
uchar data sth0;
uchar data l;
uchar data k;
uchar data key;
uchar data t;
uchar data n;
uchar Key_Value=0xff;
unsigned char bdata key;
#include <reg52.h>
#include <absacc.h>
#include <math.h>
#include<intrins.h>
0x82,0x72,0x62,0x72,0x84,0xA2,0x72,0xff };
//同一首歌
uchar code song6[]={0x42,0x82,0x82,0x82,0x86,0x72,0x63,0x71,0x62,0x52,0x48,0xB2,
0xB2,0xB2,0xB2,0xB6,0xA2,0x83,0xA1,0xA2,0x92,0x88,0x82,0xB2,
0x84,0x84,0x02,0x72,0x62,0x54,0x04,0x52,0x62,0x74,0x74,0x02,
0x62,0x52,0x64,0x44,0x04,0x42,0x62,0x54,0x14,0x02,0x32,0x52,
0x44,0x04,0xff};
//生日快乐
uchar code song3[]={0xC4,0x12,0x32,0x44,0x42,0x52,0x52,0x44,0x32,0x32,0x12,0x14,
0xA2,0xA2,0x93,0x04,0x94,0x92,0x82,0x82,0x63,0x62,0x62,0x52,
0x52,0x42,0x44,0x04,0x62,0x52,0x52,0x42,0x84,0x04,0x92,0x82,
0x94,0x82,0x63,0x04,0x84,0x82,0x82,0x82,0xB2,0xB2,0x82,0xC2,