资源简介

可以把音乐简谱转换成十六进制的tool;

资源截图

代码片段和文件信息

#include “reg52.h“
unsigned char Count;
sbit _Speak =P2^3 ; //讯响器控制脚 

unsigned char code SONG[] ={      //祝你平安
0x260x200x200x200x200x200x260x100x200x100x200x800x260x200x300x20
0x300x200x390x100x300x100x300x800x260x200x200x200x200x200x1c0x20
0x200x800x2b0x200x260x200x200x200x2b0x100x260x100x2b0x800x260x20
0x300x200x300x200x390x100x260x100x260x600x400x100x390x100x260x20
0x300x200x300x200x390x100x260x100x260x800x260x200x2b0x100x2b0x10
0x2b0x200x300x100x390x100x260x100x2b0x100x2b0x200x2b0x400x400x20
0x200x100x200x100x2b0x100x260x300x300x800x180x200x180x200x260x20
0x200x200x200x400x260x200x2b0x200x300x200x300x200x1c0x200x200x20
0x200x800x1c0x200x1c0x200x1c0x200x300x200x300x600x390x100x300x10
0x200x200x2b0x100x260x100x2b0x100x260x100x260x100x2b0x100x2b0x80
0x180x200x180x200x260x200x200x200x200x600x260x100x2b0x200x300x20
0x300x200x1c0x200x200x200x200x800x260x200x300x100x300x100x300x20
0x390x200x260x100x2b0x100x2b0x200x2b0x400x400x100x400x100x200x10
0x200x100x2b0x100x260x300x300x800x00
                                  //路边的野华不要采
0x300x1C0x100x200x400x1C0x100x180x100x200x100x1C0x100x180x400x1C
0x200x200x200x1C0x200x180x200x200x800xFF0x200x300x1C0x100x180x20
0x150x200x1C0x200x200x200x260x400x200x200x2B0x200x260x200x200x20
0x300x800xFF0x200x200x1C0x100x180x100x200x200x260x200x2B0x200x30
0x200x2B0x400x200x200x1C0x100x180x100x200x200x260x200x2B0x200x30
0x200x2B0x400x200x300x1C0x100x180x200x150x200x1C0x200x200x200x26
0x400x200x200x2B0x200x260x200x200x200x300x800x200x300x1C0x100x20
0x100x1C0x100x200x200x260x200x2B0x200x300x200x2B0x400x200x150x1F
0x050x200x100x1C0x100x200x200x260x200x2B0x200x300x200x2B0x400x20
0x300x1C0x100x180x200x150x200x1C0x200x200x200x260x400x200x200x2B
0x200x260x200x200x200x300x300x200x300x1C0x100x180x400x1C0x200x20
0x200x260x400x130x600x180x200x150x400x130x400x180x800x00

};

void Time0_Init()
{
TMOD = 0x01;
IE   = 0x82;
TH0  = 0xD8;
TL0  = 0xEF; //12MZ晶振,10ms
}

void Time0_Int() interrupt 1
{
TH0 = 0xD8;
TL0 = 0xEF;
Count++; //长度加1
}

/*-------------------------------------------------
功能:1MS延时子程序
-------------------------------------------------*/
void Delay_xMs(unsigned int x)
{
    unsigned int ij;
    for( i =0;i < x;i++ )
    {
        for( j =0;j<3;j++ );
    }
}

/*-------------------------------------------------
功能:歌曲播放子程序i为播放哪一段曲目
-------------------------------------------------*/
void Play_Song(unsigned char i)
{
unsigned char Temp1Temp2;
unsigned int Addr;
Count = 0; //中断计数器清0
Addr = i * 217;
while(1)
{
Temp1 = SONG[Addr++];

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3707  2010-05-25 22:18  main.c

     文件     224768  2010-05-26 11:09  单片机音乐转换.exe

----------- ---------  ---------- -----  ----

               228475                    2


评论

共有 条评论