PIC18F25K80,timer0定时器中断

2019-04-15 13:42发布

volatile uint32_t uwTick = 0;
void __interrupt() ISR(void)
//void attribute ( (interrupt, no_auto_psv) ) _T1Interrupt( void ) {
if((T0IF)&&(T0IE)) //定时器
{ TMR0IF=0; //T0CON=0B10010011; //enable T0,16bit,FSCO/4,16:1 TMR0H=0x9E; //40549(0x9E65)---> (65536-40549+13)*0.25*16=100,000 TMR0L=0x65; HalIncTick(); } void HalIncTick(void)
{
uwTick++;
}
} uint32_t HalGetTick(void)
{
return uwTick;
}