timer0.c
来自「AVR 门锁的程序 包含与模块通讯 密码按键」· C语言 代码 · 共 35 行
C
35 行
#include "Include.h"
void Timer0Init(void)
{
TCCR1B|=(1<<CS12);//选择输入时钟
TIMSK|=(1<<TOIE1);//开定时器1溢出中断
}
volatile unsigned char Timer=0;
//约1.5s中断一次
SIGNAL(SIG_OVERFLOW1)
{
if(Timer>0)
{
Timer--;
//LcdPrint(Timer);
}
//Timer测试
/*
{
static unsigned char i=1;
LedGreenOn(i);
i++;
if(i>9)
{
i=1;
}
}
*/
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?