timer.c
来自「AVR下的WG26中断接收函数及相关资料说明」· C语言 代码 · 共 45 行
C
45 行
#include "typedef.h"
#include "time.h"
#include "ll.h"
unsigned char prgCnt = 0;
void time(void) interrupt 1 using 2
{
// TH0=0x82; //10ms的基准定时,40M
// TL0=0x35;
TH0=0xdc; //10ms的基准定时,11.0592M
TL0=0x00;
prgCnt ++; //prg run
pwUpScanCnt ++;
if(b_spker)spkerCnt++;
if(b_com_r6c)
{
timeout --;
if(timeout==0)
{
TIMERINT=1;
b_com_r6c=0;
}
}
}
/**************************************************************/
BOOL _setTimer(uchar timeout_temp)
{
b_com_r6c = 1;
timeout = timeout_temp;
TIMERINT= 0;
TR0 = 1;
return(TRUE);
}
void _clrTimer(void)
{
b_com_r6c = 0;
timeout = 0;
TIMERINT = 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?