⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.c

📁 ATmega128芯片的测试程序
💻 C
字号:
#include"timer.h"
#include"mostns.h"

static unsigned int count;    //一个计数变量
extern bool MostCheckFlag;
extern word tick_count; //系统启动后到当前的运行时间
void Timer0Init()
{
	count=2000;
    TCNT0=0X8D;    //定时1ms
    TCCR0=0X04;
    TIMSK=_BV(TOIE0);
    
}

SIGNAL(SIG_OVERFLOW0)
{
    TCNT0=0X8D;
    tick_count++;
	count--;
	if(count==0)
	{
	   count=2000;
	   MostCheckFlag=TRUE;
     }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -