楼主可真是费了不少功夫下,每个音节都编了个FOR函数,设定延长时间。
但我想请问下能否用数组存储音乐信息呢??好像以前51单片机开发板上的实例是数组的,比如我现在手头就有//《祝你平安》对应的编码
const unsigned char SONG[]=
{
0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,
0x10,0x20,0x80,0x26,0x20,0x30,0x20,0x30,0x20,
0x39,0x10,0x30,0x10,0x30,0x80,0x26,0x0,0x20,
0x20,0x20,0x20,0x1c,0x20,0x20,0x80,0x2b,0x20,
0x26,0x20,0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,
0x80,0x26,0x20,0x30,0x20,0x30,0x20,0x39,0x10,
0x26,0x10,0x26,0x60,0x40,0x10,0x39,0x10,0x26,
0x20,0x30,0x20,0x30,0x20,0x39,0x10,0x6,0x10,
0x26,0x80,0x26,0x20,0x2b,0x10,0x2b,0x10,0x2b,
0x20,0x30,0x10,0x39,0x10,0x26,0x10,0x2b,0x10,
0x2b,0x20,0x2b,0x40,0x40,0x20,0x20,0x10,0x20,
0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x18,0x20,
0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x40,0x26,
0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,
0x20,0x20,0x20,0x80,0x1c,0x20,0x1c,0x20,0x1c,
0x20,0x30,0x20,0x30,0x60,0x39,0x10,0x30,0x10,
0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x10,0x26,
0x10,0x26,0x10,0x2b,0x10,0x2b,0x80,0x18,0x20,
0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x60,0x26,
0x10,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,
0x20,0x20,0x20,0x80,0x26,0x20,0x30,0x10,0x30,
0x10,0x30,0x20,0x39,0x20,0x26,0x10,0x2b,0x10,
0x2b,0x20,0x2b,0x40,0x40,0x10,0x40,0x10,0x20,
0x10,0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,
0x00
};
但是不知道怎么用起来?能否纸指点下?谢谢