// This project is used for demonstrating digital tubes of BSP library. #include "Beep.h" #include "STC15F2K60S2.H" #include "displayer.h" #include "huahai.h" #include "key.H" #include "music.h" #include "sys.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(); } }