请教一下TI的工程师,
CC3200 定时器可以每秒产生一次中断吗? 我想简单维持一个 时间(每10分钟从服务器获取正确时间,进行校准)
比如,希望执行一个功能, 5s后,再继续执行另一个功能。
因为程序中,有网络接收,和几个Task, 所有这个时间定时器中断应简单点,只处理每秒的中断函数, 其他时间碎片 交给其他Task处理。
不考虑功耗
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
参考官方的Timer例程
//
// Base address for first timer
//
g_ulBase = TIMERA0_BASE; //定时器0
//
// Base address for second timer
//
g_ulRefBase = TIMERA1_BASE; //定时器1
//
// Configuring the timers
// TIMER_CFG_PERIODIC-32位宽度 TimerA0/TimerA1的设置值都是TIMER_A 0不分频
// 注意预分频值只对16位定时器有效,对32位定时器无效!
// TRM-When using Timer A and Timer B in concatenated mode, only the Timer A control and status bits must be used 当采用32位时仅有TimeA控制标志位有效!因此-->TIMER_A
Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0); //其实 TIMER_A并未起作用,其传递的函数是分频函数,对32位定时器无效!
Timer_IF_Init(PRCM_TIMERA1, g_ulRefBase, TIMER_CFG_PERIODIC, TIMER_A, 0);
//
// Setup the interrupts for the timer timeouts.
//
Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler);
Timer_IF_IntSetup(g_ulRefBase, TIMER_A, TimerRefIntHandler);
//
// Turn on the timers feeding values in mSec
//
Timer_IF_Start(g_ulBase, TIMER_A, 500);
Timer_IF_Start(g_ulRefBase, TIMER_A, 1000);
//*****************************************************************************
//
//! The interrupt handler for the first timer interrupt.
//!
//! \param None
//!
//! \return none
//
//*****************************************************************************
void
TimerBaseIntHandler(void)
{
//
// Clear the timer interrupt.
//
Timer_IF_InterruptClear(g_ulBase);
g_ulTimerInts ++;
GPIO_IF_LedToggle(MCU_GREEN_LED_GPIO);
}
//*****************************************************************************
//
//! The interrupt handler for the second timer interrupt.
//!
//! \param None
//!
//! \return none
//
//*****************************************************************************
void
TimerRefIntHandler(void)
{
//
// Clear the timer interrupt.
//
Timer_IF_InterruptClear(g_ulRefBase);
g_ulRefTimerInts ++;
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
}