武汉理工大学-监测与控制课-实验5-音乐发生器程序.docx

武汉理工大学-监测与控制课-实验5-音乐发生器程序.docx

  1. 1、本文档共6页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
武汉理工大学-监测与控制课-实验5-音乐发生器程序

#include reg52.h #define uchar unsigned char #define uint unsigned int sbit key1=P3^2;//按key1可切换花样 sbit key2=P3^3;//按key2可切换歌曲 sbit fm=P1^5;//蜂鸣器连续的IO口 sbit P34=P3^4;//矩阵键盘的一列 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,0x72,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

文档评论(0)

xxj1658888 + 关注
实名认证
内容提供者

教师资格证持证人

该用户很懒,什么也没介绍

领域认证该用户于2024年04月12日上传了教师资格证

1亿VIP精品文档

相关文档