I want to make 1ms in modulo mode.
My source is working in free-running mode and up-and-down mode. ( I changed only T3CTL to set another mode)
But it doesn't work in modulo mode.
I don't know what problem is.
#include <ioCC2530.h>
#define LED0 P1_0
#define LED1 P1_1
#define LED4 P1_4
volatile int count;
void ledinit()
{
P1DIR |= ((1<<0)|(1<<1)|(1<<4));
LED0 = 0;
LED1 = 0;
LED4 = 0;
}
void timer3_init()
{
T3CTL = 0XFE; // prescaler 128, start timer, interrupt enable, modulo mode
T3CC0=125; // modulo mode (0X00~T3CCO)
}
void interrupt_int()
{
IRCON |= 0x40;
IEN0 |= 0X80;
T3IE=1;
T3CCTL0 |=0X40;
// T3CCTL1 |=0X40;
}
#pragma vector = T3_VECTOR
__interrupt void T3_ISR(void)
{
count++;
if(count>500)
{
count = 0;
LED0=~LED0;
LED1=~LED1;
LED4=~LED4;
}
}
int main()
{
ledinit();
timer3_init();
interrupt_int();
while(1);
}