Ken
这是我修改过的定时器代码。MAP_TimerPrescaleSet直接用TimerPrescaleSet代替了
加入这个TIMER_CFG_SPLIT_PAIR TIM2应该就在TIMER_A就在16bit方式吧
MAP_TimerConfigure(TIMERA2_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME));
TimerPrescaleSet(TIMERA2_BASE,TIMER_A,80);
//
// Register timer interrupt hander
//
MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler);
//
// Set the detection edge
//
MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);
//
// Set the reload value
//
MAP_TimerLoadSet(TIMERA2_BASE,TIMER_A,0xFFFF);
//
// Enable capture event interrupt
//
MAP_TimerIntEnable(TIMERA2_BASE,TIMER_CAPA_EVENT);
//
// Enable Timer
//
MAP_TimerEnable(TIMERA2_BASE,TIMER_A);
Ken
这是我修改过的定时器代码。MAP_TimerPrescaleSet直接用TimerPrescaleSet代替了
加入这个TIMER_CFG_SPLIT_PAIR TIM2应该就在TIMER_A就在16bit方式吧
MAP_TimerConfigure(TIMERA2_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME));
TimerPrescaleSet(TIMERA2_BASE,TIMER_A,80);
//
// Register timer interrupt hander
//
MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler);
//
// Set the detection edge
//
MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);
//
// Set the reload value
//
MAP_TimerLoadSet(TIMERA2_BASE,TIMER_A,0xFFFF);
//
// Enable capture event interrupt
//
MAP_TimerIntEnable(TIMERA2_BASE,TIMER_CAPA_EVENT);
//
// Enable Timer
//
MAP_TimerEnable(TIMERA2_BASE,TIMER_A);
举报