单片机做的音乐盒c语言程序,基于AT89C51制作的数字音乐盒(仿真和c程序)

#include

#define uchar unsigned char

#define uchar unsigned char

#define uint unsigned int

#define  LCDPORT P0

uchar code tab[]="Press key";

uchar code tab1[]="Select song";

uchar code tab2[]="First Song" ;

uchar code tab3[]="butterfly";

uchar code tab4[]="Second Song"        ;

uchar code tab5[]="Jingle bell ";

uchar code tab6[]="Third Song" ;

uchar code tab7[]="Yesterday";

uchar code tab8[]="Forth Song" ;

uchar code tab9[]="Youth League";

sbit LCDE=P2^2;

sbit LCDRW=P2^1;

sbit LCDRS=P2^0;

#define SYSTEM_OSC                 12000000        //定义晶振频率12000000HZ

#define SOUND_SPACE         4/5                 //定义普通音符演奏的长度分率,//每4分音符间隔

sbit    BeepIO    =           P3^7;                //定义输出管脚

sbit        K1=P1^7;

unsigned int  code FreTab[12]  = { 262,277,294,311,330,349,369,392,415,440,466,494 }; //原始频率表

unsigned char code SignTab[7]  = { 0,2,4,5,7,9,11 };                                                                   //1~7在频率表中的位置

unsigned char code LengthTab[7]= { 1,2,4,8,16,32,64 };

unsigned char Sound_Temp_TH0,Sound_Temp_TL0;        //音符定时器初值暂存

unsigned char Sound_Temp_TH1,Sound_Temp_TL1;

unsigned char code Music_Girl[]=

{ 0x1B,0x02, 0x1A,0x02, 0x1B,0x02, 0x19,0x66, 0x1A,0x03,

0x18,0x02, 0x17,0x02, 0x16,0x0D, 0x17,0x03, 0x18,0x0D,

0x17,0x03, 0x19,0x66, 0x17,0x03, 0x16,0x0D, 0x17,0x03,

0x19,0x0D, 0x16,0x03, 0x17,0x0D, 0x18,0x03, 0x17,0x0D,

0x16,0x03, 0x15,0x00, 0x19,0x02, 0x11,0x02, 0x16,0x02,

0x10,0x02, 0x15,0x02, 0x0F,0x00, 0x10,0x03, 0x15,0x03,

0x0F,0x00, 0x0D,0x01, 0x0F,0x66, 0x10,0x03, 0x15,0x66,

0x16,0x03, 0x10,0x0D, 0x15,0x03, 0x0F,0x03, 0x19,0x66,

0x1F,0x03, 0x1A,0x0D, 0x19,0x03, 0x17,0x03, 0x19,0x03,

0x16,0x00, 0x16,0x66, 0x17,0x03, 0x11,0x0C, 0x10,0x02,

0x19,0x66, 0x10,0x03, 0x15,0x02, 0x16,0x02, 0x0D,0x02,

0x15,0x02, 0x10,0x0D, 0x0F,0x03, 0x10,0x0D, 0x15,0x03,

0x0F,0x00, 0x17,0x66, 0x19,0x03, 0x11,0x02, 0x16,0x02,

0x10,0x0D, 0x15,0x03, 0x0F,0x15, 0x0D,0x03, 0x0F,0x02,

0x0D,0x03, 0x0F,0x0D, 0x10,0x03, 0x11,0x0D, 0x16,0x03,

0x10,0x00, 0x0F,0x0D, 0x10,0x03, 0x15,0x66, 0x16,0x03,

0x19,0x02, 0x17,0x02, 0x16,0x02, 0x17,0x0D, 0x16,0x03,

0x15,0x02, 0x10,0x0D, 0x0F,0x03, 0x0D,0x01, 0x15,0x01,

0x10,0x03, 0x15,0x04, 0x10,0x0D, 0x0F,0x03, 0x0D,0x0D,

0x0F,0x03, 0x10,0x0D, 0x15,0x03, 0x0F,0x00, 0x17,0x0D,

0x19,0x03, 0x16,0x0D, 0x17,0x03, 0x16,0x0D, 0x15,0x03,

0x11,0x02, 0x10,0x02, 0x0F,0x00, 0x00,0x00 };

unsigned char code Music_Jingle[]={

0x0F,0x03, 0x0F,0x03, 0x17,0x03, 0x16,0x03, 0x15,0x03,

0x0F,0x66, 0x19,0x04, 0x19,0x04, 0x0F,0x03, 0x17,0x03,

0x16,0x03, 0x15,0x03, 0x10,0x02, 0x10,0x03, 0x10,0x03,

0x18,0x03, 0x17,0x03, 0x16,0x03, 0x10,0x66, 0x10,0x03,

0x19,0x03, 0x19,0x03, 0x18,0x03, 0x16,0x03, 0x17,0x02,

0x15,0x03, 0x0F,0x03, 0x0F,0x03, 0x17,0x03, 0x16,0x03,

0x15,0x03, 0x0F,0x66, 0x0F,0x03, 0x0F,0x03, 0x17,0x03,

0x16,0x03, 0x15,0x03, 0x10,0x66, 0x10,0x03, 0x10,0x03,

0x18,0x03, 0x

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值