📄 time.c
字号:
/*******************************************************************************
* name: time.c
* author: fengzai(panda)
* date: 2007.1.27
* decribe: init the time2
*******************************************************************************/
#include <avr/io.h>
#include <avr/interrupt.h>
#include "time.h"
// the timer2 init, 30ms
void timer2_init(void)
{
TCCR2 = 0x00;//停止定时器
ASSR = 0x00;//异步时钟模式
TCNT2 = 0x28;//初始值
OCR2 = 0x27;//匹配值
TIMSK |= 0x40;//中断允许
TCCR2 = 0x07;//启动定时器
}
/*------------------------------------------------------------------------------
* end of file
*-----------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -