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.

DM6437的Timer0的定时时间乱掉



32-Bit Timer Unchained Mode下,想产生一个10秒的中断,发现每次中断产生的时间都不一样,代码如下:

void int_init()

{  CSR = 0x100;        //disable all interrupts  

IER = 1;            //disable all interrupts except NMI   

ICR = 0xffff;       //clear all pending interrupts  

ISTP = 0x10800000;   //set the ISTP equals the INT address in the .cmd

 INTC_EVTCLR0 = 0xFFFFFFFF;

 INTC_EVTCLR1 = 0xFFFFFFFF;

 INTC_EVTCLR2 = 0xFFFFFFFF;  

INTC_EVTCLR3 = 0xFFFFFFFF;    

 INTC_EVTMASK0 = 0xFFFFFFEF;        //Timer0-TINT12 is combined  

INTC_EVTMASK1 = 0xFFFFFFFF;    

INTC_EVTMASK2 = 0xFFFFFFFF;    

 INTC_EVTMASK3 = 0xFFFFFFFF;    

 INTC_INTMUX3 = 0x00040000; //map Timer0-TINT12 to INT14  

TIMER0_TIM12 = 0x00000000;  

TIMER0_PRD12 = 0x1017DF80; //27M时钟,10S计时  

TIMER0_TGCR = 0x00000005;  

TIMER0_TCR  = 0x00000080;//The timer is enabled one time. The timer stops after the counter reaches the period.

IER |= 0x00004002; //enable int14-timer0     

CSR=0x01 ;  // enable all interrupts 

}

以上代码没有产生期望的十秒中断,在中断产生时查看输出的TIMER0_TIM12的值每次都不一样。TIMER0_PRD12这个值是怎么计算的?