#include "DSP28_Device.h"
#include "DSP28_Piectrl.h"
//子函数声明
interrupt void T1UFINT_IS(void);
void main(void)
{
//step1:初始化系统控制寄存器,PLL,看门狗,时钟等
InitSysCtrl();
EALLOW; //使能PWM引脚
GpioMuxRegs.GPAMUX.all=0x00FF; //EVA PWM1-6引脚
GpioMuxRegs.GPBMUX.all=0x00FF; //EVA PWM7-12引脚
EDIS;
//step3:初始化PIE中断向量表vector table;
DINT;
IER=0x0000;
IFR=0x0000; //禁止和清除所有CPU中断;
InitPieCtrl() ; //初始化Pie控制寄存器位默认状态
InitPieVectTable();
EvaRegs.T1CNT=0X0000;
EvaRegs.T1PR=0XFFFF;
//寄存器赋值
EvaRegs.EVAIMRA.bit.T1UFINT=1;
EvaRegs.EVAIFRA.bit.T1UFINT=1; //设置中断寄存器
EvaRegs.T1CON.all=0X084; //设置计数模式
EvaRegs.GPTCONA.bit.TCOMPOE=1; //定时器1触发逻辑独立驱动比较输出,T1CNT的数开始有变化
EvaRegs.GPTCONA.bit.T1PIN=2;
while(1)
{EvaRegs.T1CMPR=0X3C00;
EALLOW;
PieVectTable.T1UFINT=&T1UFINT_IS;
EDIS;
PieCtrl.PIEIER2.all=M_INT6;
IER|=M_INT2;
EINT;
ERTM;
for(;;);
}
}
void T1UFINT_IS(void)
{
EvaRegs.T1CMPR++;
EvaRegs.EVAIMRA.bit.T1UFINT=1;
EvaRegs.EVAIFRA.all=BIT9; //清中断标志位
PieCtrl.PIEACK.all=PIEACK_GROUP2;
}
我是想通过下溢中断进中断子函数来更新T1CMPR的值,从而改变占空比,可是我这个进了中断函数就出不来,占空比不改变,大家帮我看看该怎么解决呢?