void time_init()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); //使能定时器
// SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
// SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
TimerConfigure(TIMER0_BASE,TIMER_CFG_16_BIT_PAIR|TIMER_CFG_A_PERIODIC|TIMER_CFG_B_PERIODIC); //配置模式TIMER_CFG_32_BIT_PER
TimerPrescaleSet(TIMER0_BASE,TIMER_A,199); //200分频
TimerPrescaleSet(TIMER0_BASE,TIMER_B,99); //100分频
TimerLoadSet(TIMER0_BASE, TIMER_A, 40000UL); //设定加载值
TimerLoadSet(TIMER0_BASE, TIMER_B, 40000UL);
// TimerControlTrigger(TIMER0_BASE,TIMER_A,true); //使能触发ADC
// TimerControlEvent(TIMER0_BASE,TIMER_A,TIMER_EVENT_POS_EDGE);//正边沿触发
// TimerControlLevel(TIMER0_BASE,TIMER_A,false); //PWM电平
TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT); //使能中断
TimerIntEnable(TIMER0_BASE,TIMER_TIMB_TIMEOUT);
IntEnable(INT_TIMER0A);
IntEnable(INT_TIMER0B);
// IntEnable(INT_TIMER1A);
// IntEnable(INT_TIMER1B);
// IntEnable(INT_TIMER2A);
// IntEnable(INT_TIMER2B);
main函数中开总中断
问题是进不了中断 32位模式下周期计数是能进中断的
此帖出自
小平头技术问答
一周热门 更多>