初始化
void TIMER0_INIT(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);//使能TIMER0
//TimerConfigure(TIMER0_BASE, TIMER_CFG_ONE_SHOT);//单次计数模式
//TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC_UP);//周期性计数模式,递增计数
//TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PERIODIC);
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);//周期性计数模式
TimerLoadSet(TIMER0_BASE, TIMER_A,SysCtlClockGet() /12800);
//TimerADCEventSet(TIMER0_BASE,TIMER_ADC_TIMEOUT_A);//超时触发采样设置
TimerControlTrigger(TIMER0_BASE,TIMER_A,true);
//TimerADCEventGet(TIMER0_BASE);//获取是否超时触发ADC
IntEnable(INT_TIMER0A);//TIMEOUT标志位触发中断
IntPrioritySet(INT_TIMER0A,1);//优先级1
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); //使能TIMER0A中断
IntMasterEnable();
TimerEnable(TIMER0_BASE, TIMER_A);//TIMER0A开始计数,当计数值等于TimerLoadSet,触发中断
}
|