对Timer initial的代码
void timer1Init(void)
{
unsigned int count;
T1CTL = 0x00;
T1CCTL0 = 0x00;
T1CCTL1 = 0x00;
T1CCTL2 = 0x00;
TIMIF =~0x40;
#ifndef CC2530_PG1
// Set conmpare mode with interrupt enabled
T1CCTL0 = 0x44;
#endif
// clear interrupt pending flag, disable interrupt
#ifdef CC2530_PG1
T1CTL &=~0x10; // T1CTL.OVFIF = 0
#else
T1STAT&=~0x01; // T1STAT.CH1IF = 0
#endif
T1IE = 0; // IEN1.T1IE = 0
T1CTL&=~0x0c;
/*
T1CTL|= 0x0c; // 分128频:Tick frequency/128
count = 25000; // 2500/(32MhZ/128) = 100ms
*/
T1CTL|= 0x08; // 32分频:Tick frequency/32
count = 10; // 20/(32MhZ/32) = 20uS //实际好像20us
T1CC0L = (unsigned char) count; // Setting counter value
T1CC0H = (unsigned char)(count>>8);
TIMIF |= 0x40;
T1IE = 1;
T1CTL |= 0x02;
}
start Timer 代码
void timer1Start(void)
{
T1CTL |= 0x03;
}
但是并没有执行Timer的中断
#pragma vector=T1_VECTOR
__near_func __interrupt void t1_irq(void)
{
}
我看到HAL_TIMER 为FALSE 没有define.是不是这个原因?