最近在用c6748的定时器模块定时产生中断,定时器配置为32-bit 非关联模式(选的是TMR34,不是tiMR12),连续运行周期重载模式基本配置代码如下:
TMR0->TGCR = 0x00000000; //timer reset
TMR0->TCR = 0x00000000; //internal clock source, timer disabled
//disable interrupts and set emulation to free run.
TMR0->INTCTLSTAT = 0; //disable timer's various interrupts
SETBIT(TMR0->EMUMGT, SOFT | FREE); //free run
//step:
SETBIT(TMR0->TGCR, TIMMODE_32BIT_UNCHAINED);
SETBIT(TMR0->TGCR, PRESCALER(TIMER_DIV - 1));
TMR0->TIM34 = 0x00000000; //clear timer value
TMR0->PRD34 = 625; //PRD34 = 0.0003125s/0.5us=625
SETBIT(TMR0->TGCR, PLUSEN); //enable new features(such as period reload)
SETBIT(TMR0->TCR, ENAMODE34_CONT_RELOAD); //enable continuously with period reload
TMR0->REL34 = 2* 625; //period reload register
SETBIT(TMR0->INTCTLSTAT, PRDINTEN34); //enable TIM0 interrupt
SETBIT(TMR0->TGCR, TIM34RS); //start TIM0
按如上配置,定时器中断只能进入一次,推断是定时器重载的相关配置哪里不对所致。因为如果换成定时器连续运行非周期重载模式,就可以定时进入中断。请问大家,我的定时器重载配置有哪里配置的不对或者没有配置么?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
给点儿建议吧,你觉得是哪里的问题?
一周热门 更多>