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.

大家好。本人写了非常优秀的定时器程序,可惜差一点点没跑起来。请ti工程师跟社友们帮忙,让它飞起来



谢谢大家点击进来,其实程序并不优秀,就是想麻烦大家帮看看


void delay();
void timer0(void);
unsigned int count;
main(void)
{


              InitSysCtrl();
              DINT;
              IER=0x0000;
              IFR=0x0000;
              InitPieCtrl();
              InitPieVectTable();         以上这程序没有问题,别的试验也是这样用的

              EALLOW;
              PieVectTable.TINT0=&timer0;       将中断函数的地址付给TINT0
              EDIS;
              EnableInterrupts();                       enable全部中断,我不确定定时器中断是否要调用此程序,但感觉调了也不会有错
              SysCtrlRegs.PCLKCR3.bit.CPUTIMER0ENCLK = 1;     使能timer0
              IER|=M_INT1;
              PieCtrlRegs.PIEIER1.bit.INTx7=1;
              InitCpuTimers();
              ConfigCpuTimer(&CpuTimer0,15,1000000);

              init gpio();              gpioinit这个子函数没贴出来,但是在别的试验验证过是正确的
                EINT;
                ERTM;

        for(;;)
        {
        delay(10000);
         LED1on;
         LED2off;
         delay(10000);
         LED1off;
         LED2on;
        }
}

interrupt void timer0(void)
{
         count--;
}

void delay(unsigned int x)
{
     count=x;              将期望定时值付给count
    CpuTimer0Regs.TCR.bit.TSS=0;   打开定时器
    while(count);  等待定时器count的值减至0
    CpuTimer0Regs.TCR.bit.TSS=1;   关闭定时器
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;  清楚标志位为下次中断做准备
}

打扰大家一下下,看看我程序哪里出了问题。