TI中文支持网
TI专业的中文技术问题搜集分享网站

28335中断问题

老师您好!初学,不知道什么时候进入中断,为了能说明白问题,下面的例程在开发板上已经测试了,正常,是PWM控制两个LED闪烁,我只是想知道,进入中断的条件,在哪条语句中能看到满足某个条件就进入了中断啊?感谢了

#include "DSP2833x_Device.h"     // DSP2833x Headerfile Include File

#include "DSP2833x_Examples.h"   // DSP2833x Examples Include File

 

 #define PWM1_INT_ENABLE  1

 #define PWM2_INT_ENABLE  1

#define PWM3_INT_ENABLE  1

#define PWM1_TIMER_TBPRD   0x1FFF

 #define PWM2_TIMER_TBPRD   0x1FFF

#define PWM3_TIMER_TBPRD   0x1FFF

 

#define DELAY 1000000L

 

interrupt void epwm1_timer_isr(void);

interrupt void epwm2_timer_isr(void);

interrupt void epwm3_timer_isr(void);

void InitEPwmTimer(void);

 Uint32  EPwm1TimerIntCount;

Uint32  EPwm2TimerIntCount;

Uint32  EPwm3TimerIntCount;

 Uint32  LoopCount;

 

void main(void)

 {  

 InitSysCtrl();

 DINT;

 InitPieCtrl();

 IER = 0x0000;

 IFR = 0x0000;

InitPieVectTable();

 EALLOW;

   PieVectTable.EPWM1_INT = &epwm1_timer_isr;  

  PieVectTable.EPWM2_INT = &epwm2_timer_isr;   

 PieVectTable.EPWM3_INT = &epwm3_timer_isr;

  EDIS;

 InitEPwmTimer();

 InitFlash();

EPwm1TimerIntCount = 0;   

EPwm2TimerIntCount = 0;   

EPwm3TimerIntCount = 0;   

LoopCount = 0;

  EINT;

 ERTM;

InitXintf();

 for(;;)

{}

}

void InitEPwmTimer()

 {

   EALLOW;

   SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;     

  EDIS;

   // Setup Sync  

  EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; 

EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; 

 EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; 

   // Allow each timer to be sync'ed

   EPwm1Regs.TBCTL.bit.PHSEN = TB_ENABLE;   

 EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;   

 EPwm3Regs.TBCTL.bit.PHSEN = TB_ENABLE;

   EPwm1Regs.TBPHS.half.TBPHS = 100;  

  EPwm2Regs.TBPHS.half.TBPHS = 200;   

 EPwm3Regs.TBPHS.half.TBPHS = 300;

   EPwm1Regs.TBPRD = PWM1_TIMER_TBPRD;   

 EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;   

  EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO;    

 EPwm1Regs.ETSEL.bit.INTEN = PWM1_INT_ENABLE; 

  EPwm1Regs.ETPS.bit.INTPRD = ET_1ST;          

   EPwm2Regs.TBPRD = PWM2_TIMER_TBPRD;   

 EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;    

EPwm2Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO;    

  EPwm2Regs.ETSEL.bit.INTEN = PWM2_INT_ENABLE;  

   EPwm2Regs.ETPS.bit.INTPRD = ET_2ND;           

   EPwm3Regs.TBPRD = PWM3_TIMER_TBPRD;

   EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;    

   EPwm3Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO;     

 EPwm3Regs.ETSEL.bit.INTEN = PWM3_INT_ENABLE;  

 EPwm3Regs.ETPS.bit.INTPRD = ET_3RD;           

   EALLOW;   

SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;        

 EDIS;

}

 interrupt void epwm1_timer_isr(void)

{

   // Put the Flash to sleep   

 FlashRegs.FPWR.bit.PWR = FLASH_SLEEP;

   EPwm1TimerIntCount++;   

 if ((EPwm1TimerIntCount%2000)==0)   

 GpioDataRegs.GPATOGGLE.bit.GPIO0 = 1;

 

  EPwm1Regs.ETCLR.bit.INT = 1;

 

 PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

 }

 

 interrupt void epwm2_timer_isr(void)

 {   

 EPwm2TimerIntCount++;    

 if ((EPwm2TimerIntCount%2000)==0)   

GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1;

  FlashRegs.FPWR.bit.PWR = FLASH_STANDBY;

 EPwm2Regs.ETCLR.bit.INT = 1;

 

 PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

 }

interrupt void epwm3_timer_isr(void)

 {   

Uint16 i;

  EPwm3TimerIntCount++;

  for(i = 1; i < 0x01FF; i++) {}

EPwm3Regs.ETCLR.bit.INT = 1;

  PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

 }

 

 

赞(0)
未经允许不得转载:TI中文支持网 » 28335中断问题
分享到: 更多 (0)