📄 timer0.h
字号:
#ifndef _TIMER0_H
#define _TIMER0_H
#include "PubFunc.h"
#define TIME0_4CLK_INTERVAL
#define SYSTEM_CLOCK (4.0000) //(16.0000)
#ifdef TIME0_4CLK_INTERVAL
#define TIMER_RELOAD_VALUE(interval) (-(WORD)((float)interval * SYSTEM_CLOCK / 4.0))
#else
#define TIMER_RELOAD_VALUE(interval) (-(WORD)((float)interval * SYSTEM_CLOCK / 12.0))
#endif
#define TIMER0_INTERVAL 10
#define RELOAD_TIMER0_TL0 (LOBYTE(TIMER_RELOAD_VALUE(TIMER0_INTERVAL * 1000)))
#define RELOAD_TIMER0_TH0 (HIBYTE(TIMER_RELOAD_VALUE(TIMER0_INTERVAL * 1000)))
#define RELOAD_TIMER0 \
{\
TL0 = LOBYTE(TIMER_RELOAD_VALUE(TIMER0_INTERVAL * 1000));\
TH0 = HIBYTE(TIMER_RELOAD_VALUE(TIMER0_INTERVAL * 1000));\
}
#define SECONDS(n) ((WORD)(1000.0 / (float)TIMER0_INTERVAL * n))
#define MSECONDS(n) ((WORD)((float)n / (float)TIMER0_INTERVAL))
typedef struct {
WORD wStart;
WORD wEnd;
BYTE bytType; //if(wStart < wEnd) bytType = 0; else bytType = 1;
}TIMER_DATA;
#define CUSTOM_TIMER TIMER_DATA data
struct tm_counter{
unsigned char ten_ms;
unsigned char second;
unsigned char minute;
unsigned char hour;
unsigned char day;
unsigned char counter_max;
};
extern void SetCustomTimer(CUSTOM_TIMER *ptmr, WORD data wElapse);
extern bit IsTimeOut(CUSTOM_TIMER *ptmr);
extern WORD data gwSystemTime;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -