音乐播放器程序源代码及注释
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
音乐播放器程序源代码及注释:
#include
#define uchar unsigned char
#define uint unsigned int
sbit duan=P2^6;
sbit key1=P3^2;//按key1可切换花样
sbit key2=P3^3;//按key2可切换歌曲
sbit fm=P2^4;//蜂鸣器连续的IO口
sbit P30=P3^0;//矩阵键盘的一列
uchar code huayang1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,
0xfd,0xfb,0xf7,0xef,0xdf,0xbf};//花样1
uchar code huayang2[]={0x7f,0xfe,0xbf,0xfd,0xdf,0xfb,0xef,0xf7,
0xef,0xfb,0xdf,0xfd,0xbf,0xfe};//花样2
uchar code huayang3[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x0,
0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; char code huayang4[]={ 0x55,0xaa,0xcc,0x33,0x99,0x66,0x0f,0xf0}; uchar count1;//花样标志
uchar count2;//歌曲标志
uchar timeh,timel,i;
//编程规则:字节高位是简谱,低位是持续时间,
//代表多少个十六分音符
//1-7代表中央C调,8-E代表高八度,0代表停顿
//最后的0是结束标志
uchar code qnzl[]={ //千年之恋
0x12,0x22,0x34,0x84,0x74,0x54,0x38,0x42,0x32,0x22,0x42,0x34,0x84,0 x72,0x82,0x94,0xA8,0x08,
//前奏
0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,
//竹林的灯火到过的沙漠
0x32,0x31,0x21,0x32,0x82,0x71,0x81,0x71,0x51,0x32,0x22,
//七色的国度不断飘逸风中
0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,
//有一种神秘灰色的旋涡
0x32,0x31,0x21,0x32,0x83,0x82,0x71,0x72,0x02,
//将我卷入了迷雾中
0x63,0xA1,0xA2,0x62,0x92,0x82,0x52,
//看不清的双手
0x31,0x51,0x63,0x51,0x63,0x51,0x63,0x51,0x62,0x82,0x7C,0x02,
//一朵花传来谁经过的温柔
0x61,0x71,0x82,0x71,0x62,0xA2,0x71,0x76,
//穿越千年的伤痛
0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,
//只为求一个结果
0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,
//你留下的轮廓指引我
0x42,0x63,0x83,0x83,0x91,0x91,
//黑夜中不寂寞
0x61,0x71,0x82,0x71,0x62,0x0A2,0x71,0x76,
//穿越千年的哀愁
0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,
//是你在尽头等我
0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,
//最美丽的感动会值得
0x42,0x82,0x88,0x02,0x74,0x93,0x89,0xff//结束标志
//用一生守候
};
uchar code jmszl[]={ //寂寞沙洲冷
0x12,0x12,0x22,0x32,0x31,0x22,0x21,0x22,
//自你走后心憔悴
0x21,0x31,0x51,0x52,0x31,0x52,0x61,0x15,0x14,
//白色油桐风中纷飞
0x51,0x52,0x31,0x52,0x62,0x13,0x11,0x13,0x32,0x28,0x08,0x28,
//落花似人有情这个季节
0x31,0x32,0x31,0x32,0x11,0x21,0x51,0x52,0x51,0x52,
//河畔的风放肆拼命地吹
0x51,0x51,0x31,0x32,0x31,0x32,0x81,0x72,0x63,
//不断拨弄离人的眼泪
0x62,0x71,0x81,0x72,0x61,0x61,0x52,0x31,0x21,0x32,0x51,0x54,
//那样浓烈的爱再也无法给
0x22,0x12,0x11,0x12,0x11,0x12,0x12,0x14,0x26,0x32,0x26,
//伤感一夜一夜
0x32,0x61,0x51,0x51,0x31,0x31,0x21,0x31,0x51,0x61,0x51,0x31,0x51, //当记忆的线缠绕过往支离破碎
0x02,0x32,0x81,0x81,0x81,0x81,0x62,0x52,0x34,