diff --git a/music2/huahai.h b/music2/huahai.h new file mode 100644 index 0000000..5a26be0 --- /dev/null +++ b/music2/huahai.h @@ -0,0 +1,23 @@ +// 花海 周杰伦 +#pragma once + +// tone: F/0xFF, 75 beats per minute + +code char huahai[] = { + 0x21, 0x04, 0x23, 0x08, 0x23, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x10, 0x23, 0x18, 0x20, 0x10, // 静止了 所有的花开 + 0x21, 0x04, 0x23, 0x08, 0x23, 0x24, 0x24, 0x08, 0x23, 0x08, 0x25, 0x0a, 0x21, 0x24, 0x20, 0x10, // 遥远了 清晰的爱 + 0x21, 0x04, 0x24, 0x08, 0x24, 0x24, 0x24, 0x08, 0x23, 0x08, 0x21, 0x08, 0x15, 0x10, 0x23, 0x18, 0x20, 0x10, // 天郁闷 爱却很喜欢 + 0x21, 0x04, 0x23, 0x08, 0x22, 0x14, 0x21, 0x04, 0x23, 0x08, 0x22, 0x14, 0x21, 0x04, 0x23, 0x08, 0x22, 0x24, 0x20, 0x10, // 那时候我不懂这叫爱 + 0x21, 0x04, 0x23, 0x08, 0x23, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x10, 0x25, 0x14, 0x23, 0x04, 0x20, 0x10, // 你喜欢 站在那窗台 + 0x21, 0x04, 0x23, 0x08, 0x23, 0x24, 0x24, 0x08, 0x23, 0x08, 0x25, 0x08, 0x21, 0x28, 0x20, 0x10, // 你好久 都没再来 + 0x21, 0x04, 0x24, 0x08, 0x24, 0x24, 0x24, 0x08, 0x23, 0x08, 0x21, 0x08, 0x25, 0x10, 0x23, 0x10, 0x31, 0x14, 0x26, 0x04, 0x20, 0x10, // 彩色的 时间染上空白 + 0x25, 0x08, 0x24, 0x08, 0x24, 0x08, 0x21, 0x08, 0x21, 0x10, 0x17, 0x08, 0x21, 0x28, 0x20, 0x10, // 是你流的泪晕开 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x04, 0x25, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x04, 0x23, 0x24, 0x20, 0x10, // 不要你离开 距离隔不开 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x27, 0x08, 0x31, 0x1c, 0x31, 0x08, 0x27, 0x08, 0x26, 0x08, 0x25, 0x08, 0x26, 0x04, 0x26, 0x08, 0x25, 0x0a, 0x20, 0x10, // 思念变成海 在窗外进不来 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x04, 0x25, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x04, 0x21, 0x24, 0x20, 0x10, // 原谅说太快 爱成了阻碍 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x08, 0x25, 0x08, 0x24, 0x08, 0x24, 0x08, 0x23, 0x08, 0x31, 0x10, 0x23, 0x08, 0x23, 0x08, 0x22, 0x20, 0x20, 0x10, // 手中的风筝放太快回不来 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x04, 0x25, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x04, 0x23, 0x24, 0x20, 0x10, // 不要你离开 回忆划不开 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x27, 0x04, 0x31, 0x1c, 0x31, 0x08, 0x27, 0x08, 0x26, 0x08, 0x25, 0x08, 0x26, 0x04, 0x26, 0x08, 0x25, 0x0a, 0x20, 0x10, // 欠你的宠爱 我在等待重来 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x04, 0x25, 0x24, 0x23, 0x08, 0x22, 0x08, 0x21, 0x08, 0x22, 0x04, 0x21, 0x24, 0x20, 0x10, // 天空仍灿烂 它爱着大海 + 0x21, 0x08, 0x22, 0x08, 0x23, 0x08, 0x25, 0x04, 0x21, 0x24, 0x21, 0x08, 0x17, 0x08, 0x16, 0x08, 0x17, 0x04, 0x21, 0x24, 0x20, 0x10, // 情歌被打败 爱已不存在 +}; \ No newline at end of file diff --git a/music2/main.c b/music2/main.c new file mode 100644 index 0000000..f0e6ed0 --- /dev/null +++ b/music2/main.c @@ -0,0 +1,54 @@ +// This project is used for demonstrating digital tubes of BSP library. +#include "STC15F2K60S2.H" +#include "displayer.h" +#include "key.H" +#include "music.h" +#include "Beep.h" +#include "sys.H" +#include "huahai.h" + +code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致 +#ifdef _displayer_H_ //显示模块选用时必须。(数码管显示译码表,用戶可修改、增加等) +code char decode_table[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x00, 0x08, 0x40, 0x01, 0x41, 0x48, + /* 序号: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ + /* 显示: 0 1 2 3 4 5 6 7 8 9 (无) 下- 中- 上- 上中- 中下- */ + 0x3f | 0x80, 0x06 | 0x80, 0x5b | 0x80, 0x4f | 0x80, 0x66 | 0x80, 0x6d | 0x80, 0x7d | 0x80, 0x07 | 0x80, 0x7f | 0x80, 0x6f | 0x80}; +/* 带小数点 0 1 2 3 4 5 6 7 8 9 */ +#endif + +char result; + +void startOrPause() +{ + if(GetKeyAct(enumKey1)==enumKeyPress) + { + + if(GetPlayerMode()==enumModePlay) + { + SetPlayerMode(enumModePause); + } + else + { + SetPlayerMode(enumModePlay); + } + } +} + +void main() +{ + DisplayerInit(); + KeyInit(); + MusicPlayerInit(); + BeepInit(); + SetDisplayerArea(0, 7); + LedPrint(0x00); + Seg7Print(10, 10, 10, 10, 10, 10, 10, 10); + SetMusic(75,0xff,huahai,sizeof(huahai),enumMscDrvSeg7andLed); + SetEventCallBack(enumEventKey,startOrPause); + MySTC_Init(); + SetPlayerMode(enumModePlay); + while (1) + { + MySTC_OS(); + } +} diff --git a/music2/music2.uvopt b/music2/music2.uvopt new file mode 100644 index 0000000..5a80ef0 --- /dev/null +++ b/music2/music2.uvopt @@ -0,0 +1,209 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x0 + MCS-51 + + 35000000 + + 1 + 1 + 1 + 0 + 0 + + + 0 + 65535 + 0 + 0 + 0 + + + 120 + 65 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + -1 + + + + + + + + + + + + + + + 0 + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + Source Group 1 + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + .\huahai.h + huahai.h + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 3 + 4 + 0 + 0 + 0 + .\STCBSP_V3.6.LIB + STCBSP_V3.6.LIB + 0 + 0 + + + +
diff --git a/music2/music2.uvproj b/music2/music2.uvproj new file mode 100644 index 0000000..e3c7691 --- /dev/null +++ b/music2/music2.uvproj @@ -0,0 +1,400 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x0 + MCS-51 + 0 + + + STC15F2K60S2 Series + STC + IRAM(0-0xFF) XRAM(0-0x6FF) IROM(0-0xEFF8) CLOCK(35000000) MODP2 + + "LIB\STARTUP.A51" ("Standard 8051 Startup Code") + + 62472 + STC15F2K60S2.H + + + + + + + + + + + 0 + 0 + + + + STC\ + STC\ + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + music2 + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 0 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + 65535 + + + S8051.DLL + + DP51.DLL + -pDP8051 + S8051.DLL + + TP51.DLL + -p51 + + + + 0 + 0 + 0 + 0 + 16 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + -1 + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 0 + 0 + -1 + + 0 + + + + + + + 0 + + + + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x10000 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0xeff9 + + + 0 + 0x0 + 0x100 + + + 0 + 0x0 + 0x700 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + 0 + 0 + 1 + 0 + 1 + 3 + 8 + 2 + 1 + 1 + 0 + 0 + + + + + ..\inc + + + + 0 + 1 + 0 + 0 + + + + + + + + + 0 + 0 + 1 + 0 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source Group 1 + + + huahai.h + 5 + .\huahai.h + + + main.c + 1 + .\main.c + + + STCBSP_V3.6.LIB + 4 + .\STCBSP_V3.6.LIB + + + + + + + +