资源简介
里面包括两个文档,一个是C语言写的程序,另外一个是可以直接烧进单片机进行执行的hex文件,该程序主要功能是通过两个按键,来选择两首旋律,分别是《两只老虎》和《蝶恋》
代码片段和文件信息
//用定时器产生延迟,并通过蜂鸣器来播放一段旋律,下表为各个音符对应的频率值
//---------------------------------------------------------------------------------------------------------------------------------------------
//简谱 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1
//频率 523 587 659 698 784 880 987 1046 1174 1318 1396 1567 1760 1975 2092
//周期(us) 1912.04 1703.58 1517.45 1432.7 1275.5 1136.4 1013.2 956 851.8 758.7 716.3 638.2 568.2 506.3 478
//半周期 956 851.8 758.73 716.3 637.7 568.2 506.6 478 425.9 379.3 358.1 319.1 284.1 253.1 239
//本程序对应的数字 0xEF 0xD5 0xCE 0xb3 0xa0 0x8e 0x7f 0x78 0x6A 0x5f 0x5a 0x50 0x47 0x3f 0x3c
//----------------------------------------------------------------------------------------
//
#include
#define uint unsigned int
#define uchar unsigned char
#define ulong unsigned long
sbit BEEP=P3^7; //喇叭输出端
sbit LED=P0^5; //指示灯端口
uchar Song_index;
uchar status; //用于判断按键是否按下
uchar code song[]={0x780x100x6A0x100x5F0x100x780x100x780x100x6A0x100x5F0x100x780x100x5F0x100x5A0x100x500x200x5F0x100x5A0x100x500x20
0x500x080x470x080x500x080x5A0x050x5F0x100x780x100x500x080x470x080x500x080x5A0x080x5F0x100x780x10
0x780x100xA00x100x780x200x780x100xA00x100x780x200x00//两只老虎
0x5F0x100x5F0x100x5F0x100x6A0x100x5F0x40
0x6A0x100x5F0x100x6A0x100x6A0x100x8E0x200x8E0x100x7F0x100x780x200x6A0x10
0x780x100x7F0x200x8E0x100xA00x100x8E0x80/*一起走过*/
0x5F0x100x5F0x100x5F0x100x6A0x100x5F0x300x470x100x500x100x470x100x500x100x500x100x6A0x20
0x6A0x100x5F0x100x5A0x200x500x100x5A0x100x5F0x200x6A0x100x780x100x5F0x70/*的承诺*/
0x5F0x100x470x200x3F0x100x470x100x500x300x5F0x100x500x60/*飘过*/
0x5F0x100x500x100x6A0x200x470x100x500x100x5F0x200x6A0x100x6A0x100x5F0x80/*传说*/
0x6A0x200x470x100x470x500x780x200x470x100x470x300x470x100x3F0x100x3C0x20/*天地痴*/
0x3F0x100x470x100x3F0x200x500x200x470x800x000x00};
/*uchar code song2[]={0x5F0x100x5F0x100x5F0x100x6A0x100x5F0x40
0x6A0x100x5F0x100x6A0x100x6A0x100x8E0x200x8E0x100x7F0x100x780x200x6A0x10
0x780x100x7F0x200x8E0x100xA00x100x8E0x80//一起走过
0x5F0x100x5F0x100x5F0x100x6A0x100x5F0x300x470x100x500x100x470x100x500x100x500x100x6A0x20
0x6A0x100x5F0x100x5A0x200x500x100x5A0x100x5F0x200x6A0x1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5467 2009-10-17 19:56 Music_Rhythm.c
文件 1313 2009-10-17 19:01 Music_Rhythm.hex
----------- --------- ---------- ----- ----
6780 2
相关资源
- 合泰触摸单片机BS84B08C实际应用代码上
- 基于STM32单片机的心率体温测量仪
- 九齐单片机源码
- 单片机PID控制(C语言)
- 基于单片机的交通灯设计.doc
- C51单片机技术教程(304页)
- C51单片机交通
- 单片机C语言实战开发108例
- stm32库函数代码自动生成器V1.2
- 单片机电子密码锁
- 单片机程序(附初级、中级、高级共
- 按键可调万年历(单片机程序)
- 51单片机数码管四层电梯模拟系统
- 基于51单片机的温控系统
- 51单片机protues文件(KST-51.DSN)
- 51单片机交通灯设计
- 基于51单片机的简易计算器
- 单片机按键长按
- 基于51单片机多路超声波报警设计
- 51单片机红外智能小车
- 单片机控制绕线机.c
- qt上位机采集51单片机温湿度数据
- AVR单片机SPI通讯程序 (C语言源代码)
- BP神经网络C语言工程当前最终版
- 汉字取模软件----单片机使用必备
- 基于51单片机射频RFID卡考勤上课上班
- 可以在单片机上计算的BP神经网络C语
- 基于51单片机的888光立方设计.rar
- 单片机C语言与PROTUES仿真技能实训
- DES和3DES加密算法,C语言,适用于单片
评论
共有 条评论