?? cepintimer.c
字號:
//cepinTimer.c : source file for the cepin Timers
//
#include "cepin.h"
#include "cepinTimer.h"
/////////////////////////////////////////////////////////////////////////////
//cepinTimer
void timers_init(void)
{
//{{WIZARD_MAP(Timers)
// Timer/Counter0 Clock source: System Clock
// Timer/Counter0 Clock value: Stopped
// Timer/Counter0 Mode: Normal
// Timer/Counter0 Output: Disconnected
OCR0 = 0x00;
TCNT0 = 0x00;
TCCR0 = 0x00;
// Timer/Counter1 Clock source: System Clock
// Timer/Counter1 Clock value: 8000.000kHz
// Timer/Counter1 Mode: Normal
// Timer/Counter1 Output: A: Disconnected, B: Disconnected
OCR1A = 0x0000;
OCR1B = 0x0000;
TCNT1 = 0x0000;
TCCR1A = 0x00;
TCCR1B = 0x42;//上升沿捕捉,8分頻
// Timer/Counter2 Clock source: System Clock
// Timer/Counter2 Clock value: Stopped
// Timer/Counter2 Mode: Normal
// Timer/Counter2 Output: Disconnected
ASSR = 0x00;
OCR2 = 0x00;
TCNT2 = 0x00;
TCCR2 = 0x00;
TIMSK = 0x65;
//}}WIZARD_MAP(Timers)
}
SIGNAL(SIG_INPUT_CAPTURE1)
{
uint f1,f2;
extern uint f3;
// TODO: Add your code here
f1=ICR1;
if(f1 >= f2)
f3=f1-f2;
else
f3=0xffff-f2+f1;
f2=f1;
}
SIGNAL(SIG_OUTPUT_COMPARE2)
{
// TODO: Add your code here
}
SIGNAL(SIG_OVERFLOW1)
{
// TODO: Add your code here
TCNT1=0x0000;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -