eecs-bsp-test-code/1919810_2/source/main.c

44 lines
1.6 KiB
C

// This project is used for demonstrating digital tubes of BSP library.
#include "STC15F2K60S2.H"
#include "displayer.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
void switch_status()
{
static int status;
if (status == 0)
{
SetDisplayerArea(2, 7);
Seg7Print(0, 0, 1, 1, 4, 5, 1, 4);
status = 1;
}
else
{
SetDisplayerArea(1, 7);
Seg7Print(0, 1, 9, 1, 9, 8, 1, 0);
status = 0;
}
}
void main()
{
DisplayerInit();
SetDisplayerArea(0, 7);
LedPrint(0);
SetEventCallBack(enumEventSys1S, switch_status);
MySTC_Init();
while (1)
{
MySTC_OS();
}
}