i have asked a question about zstack timer at http://e2e.ti.com/support/low_power_rf/f/158/p/63096/227779.aspx#227779
And Dirty Harry said "Timers 1, 3, & 4 are available to the application for as fine resolution as possible."
So I modified my program as follows:
1.GenericApp.c:
void GenericApp_HandleKeys( byte shift, byte keys )
{
if ( keys & HAL_KEY_SW_3 )
{
HalLedSet(HAL_LED_2,HAL_LED_MODE_ON);
HalTimerConfig(HAL_TIMER_2,
HAL_TIMER_MODE_NORMAL,
HAL_TIMER_CHANNEL_SINGLE,
HAL_TIMER_CH_MODE_OVERFLOW,
TRUE, //enable timer interrupt
NULL);
HalTimerStart(HAL_TIMER_2,100); //100us
}
}
2. hal_timer.c
HAL_ISR_FUNCTION( halTimer4Isr, T4_VECTOR )
{
halProcessTimer4 ();
}
uint32 dimmer_count=0;
void halProcessTimer4 (void)
{
dimmer_count++;
if(dimmer_count==5000)
{
HalTimerStop(HAL_TIMER_2);
HalLedSet(HAL_LED_1,HAL_LED_MODE_ON);
dimmer_count=0;
}
}
i think the timer interrupt will be trigered after 100us*5000=500ms.
But actually LED_1 turn on after LED_2 5000ms.
So i think maybe TICK_TIME affect this result. and i modified
"#define TICK_TIME 100",and found it has no relationship with TICK_TIME.
What's the matter with my program? And how can i get a timer less than 1ms?
Thank you.