1、/ TMDX ALPHA RELEASE/ Intended for product evaluation purposes/#/ FILE: DSP28_Example.c/ TITLE: DSP28 CPU_Timer example program./#/ Ver | dd mmm yyyy | Who | Description of changes/ =|=|=|=/ 0.55| 06 May 2002 | S.S. | EzDSP Alpha Release/ 0.57| 27 May 2002 | L.H. | No change/#/ Step 0. Include requi
2、red header files/ DSP28_Device.h: device specific definitions #include statements for/ all of the peripheral .h definition files./ DSP28_Example.h is specific for the given example. #include “DSP28_Device.h“unsigned int flag=0;interrupt void eva_CMP1_isr(void);interrupt void eva_T1UF_isr(void);void
3、main(void)/*初始化系统*/InitSysCtrl();/*关中断*/DINT;IER = 0x0000;IFR = 0x0000;/*初始化 PIE 控制寄存器 */InitPieCtrl();/*初始化 PIE 矢量表*/InitPieVectTable();EALLOW;PieVectTable.T1UFINT=PieVectTable.T1CINT=EDIS;/*初始化 EV*/InitEv();PieCtrl.PIEIER2.all=M_INT6;PieCtrl.PIEIER2.all=M_INT5;/ PieCtrl.PIEIER2.all=M_INT2;/ PieCtr
4、l.PIEIER2.all=M_INT3;IER |=M_INT2;EINT;ERTM;for(;)KickDog();interrupt void eva_T1UF_isr(void)EvaRegs.CMPR1= 4687.5*3;EvaRegs.CMPR2=4687.5;EvaRegs.CMPR3=4687.5*2;EvaRegs.EVAIFRA.bit.T1UFINT=1;PieCtrl.PIEACK.all=PIEACK_GROUP2;EINT; interrupt void eva_CMP1_isr(void)if(flag=0)EvaRegs.CMPR1= 4687.5*2;EvaRegs.CMPR2=4687.5*4;EvaRegs.CMPR3=4687.5;flag=flag+1;else flag=flag-1;EvaRegs.EVAIFRA.bit.T1CINT=1;PieCtrl.PIEACK.all=PIEACK_GROUP2;EINT;/=/ No more./=