为什么我用CPU定时器0写的跑马灯有灯一直亮?
#include"DSP2833x_Device.h"
#include"DSP2833x_Examples.h"
interrupt void ISRTimer0(void);
Uin** status;
void main(void){
InitSysCtrl();
InitGpio();
InitCpuTimers();
status=0;
DINT;
InitPieCtrl();
IER=0x0000;
IFR=0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.TINT0 = &ISRTimer0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0=0;
GpioCtrlRegs.GPADIR.bit.GPIO0=1;
GpioCtrlRegs.GPAMUX1.bit.GPIO1=0;
GpioCtrlRegs.GPADIR.bit.GPIO1=1;
EDIS;
IER |=M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx7=1;
EINT;
ERTM;
ConfigCpuTimer(&CpuTimer0,150,2000000);
StartCpuTimer0();
//for(;;){
// }
}
interrupt void ISRTimer0(void){
if(status==0)
{GpioDataRegs.GPADAT.bit.GPIO0=0;
GpioDataRegs.GPADAT.bit.GPIO1=1;}
else if(status==1)
{GpioDataRegs.GPADAT.bit.GPIO0=1;
GpioDataRegs.GPADAT.bit.GPIO1=0;
}
status++;
if(status>1)
status=0;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
CpuTimer0Regs.TCR.bit.TIF=1;
CpuTimer0Regs.TCR.bit.TRB=1;
}
|