#include "DSP28_Device.h"
//子函数声明
interrupt void eva_timer1_isr(void);
//全局中断计数变量
int Direct1=0;
int Direct2=0;
Uint32 EvaTimer1InterruptCount;
void main(void)
{
/*初始化系统*/
InitSysCtrl();
/*关中断*/
DINT;
IER = 0x0000;
IFR = 0x0000;
/*初始化PIE控制寄存器*/
InitPieCtrl();
/*初始化PIE矢量表*/
InitPieVectTable();
/*初始化EV*/
InitEv();
//重新分配中断服务的中断向量
EALLOW;
PieVectTable.T1PINT = &eva_timer1_isr; //定时器1计数中断
EDIS;
//初始化变量
EvaTimer1InterruptCount = 0;
// 使能 PIE 组 2 中断 4 -- T1PINT
PieCtrl.PIEIER2.all = M_INT4;
// 使能CPU中断
IER |= M_INT2 ;
EINT;
ERTM;
for(;;)
{
KickDog();
}
}
/**********************************************/
//EVGP1周期中断/**********************************************/
interrupt void eva_timer1_isr(void)
{
EvaTimer1InterruptCount++;
if((EvaRegs.CMPR1>=0xfff3)||(EvaRegs.CMPR1==0x0011))
Direct1=(Direct1==0)?1:0;
if((EvaRegs.CMPR2>=0xfff3)||(EvaRegs.CMPR2==0x0011))
Direct2=(Direct2==0)?1:0;
if(Direct1==0)
EvaRegs.CMPR1=EvaRegs.CMPR1+0x500;
else
EvaRegs.CMPR1=EvaRegs.CMPR1-0x500;
if(Direct2==0)
EvaRegs.CMPR2=EvaRegs.CMPR2+0x500;
else
EvaRegs.CMPR2=EvaRegs.CMPR2-0x500;
//使能中断
EvaRegs.EVAIMRA.bit.T1PINT = 1;
//清除中断标志
EvaRegs.EVAIFRA.all = BIT7;
//中断应答接收更多的 PIE 组 2的中断
PieCtrl.PIEACK.all = PIEACK_GROUP2;
}
哪位大神帮我解释下EVGP1周期中断函数啊!!!!
此帖出自
小平头技术问答
一周热门 更多>