Hello everyone. I am learning to use the CC2530. I set the program below to test the Timer 1 interrupt. But it does not work. The T1_ISR was never called. If I use the free running mode, i.e. T1CTL |= 0x01, the program work normal.
void T1_ISR (void) __interrupt 9
{
EA=0;
flag +=1 ;
if (flag<2) {
P1_0=0;
} else {
P1_0=1;
};
if (flag>2) flag=0 ;
EA=1;
}
void main(void)
{
EA=0;
T1CTL=0;
TIMIF=0x00;
IEN0=0;
IEN1=0;
IEN2=0;
P1DIR |= 0x01 ;
P1_0=0;
T1CTL |= 0x0C; // prescaler = 128
T1CNTL=0; // reset timer
T1CC0H = 0xFF;
T1CC0L = 0x00;
T1CTL |= 0x02; // timer 1 in modulo mode
T1STAT &= ~0x01;
IEN1 |= 0x02; // IEN1.T1EN = 1
TIMIF=0x40;
EA=1;
for (;;) { };
}
So, do I misundestand the usage of the Timer 1 in modulo mode?
Thanks in advance for any hint.
Ng