我的程序是这样写的,
#include \"DSP28_Device.h\"
interrupt void T1INT(void);
void InitGpio()
{
EALLOW;
GpioMuxRegs.GPAMUX.all=0x0000;
GpioMuxRegs.GPADIR.all=0xFFFF;
GpioMuxRegs.GPAQUAL.all=0x0000;
EDIS;
GpioDataRegs.GPASET.all=0x0001;
}
void InitEv()
{
//允许timer1周期中断
EvaRegs.EVAIMRA.all=EvaRegs.EVAIMRA.all|0x0080;
//清除timer1周期中断标志
EvaRegs.EVAIFRA.all=EvaRegs.EVAIFRA.all&0x0080;
EvaRegs.T1CON.all=0x1000;
EvaRegs.T1PR=0x000A;
EvaRegs.T1CNT=0x00;
}
void main()
{
/*初始化系统*/
InitSysCtrl();
/*关中断*/
DINT;
IER = 0x0000;
IFR = 0x0000;
/*初始化PIE控制寄存器*/
InitPieCtrl();
/*初始化PIE矢量表*/
InitPieVectTable();
/*初始化Gpio*/
InitGpio();
//初始化外设
InitPeripherals();
//初始化EV
InitEv();
//定位中断服务子程序
EALLOW;
PieVectTable.T1PINT = &T1INT;
EDIS;
/*开中断*/
IER |= M_INT2;
EINT;
ERTM;
EvaRegs.T1CON.all|=0x0040;
for(;
{
KickDog();
}
}
interrupt void T1INT(void)
{
EvaRegs.T1CNT=0x00;
GpioDataRegs.GPATOGGLE.all=0x0001;
PieCtrl.PIEACK.all=0x0080;
EINT;
}