大家好。
我正在使用F28027 Piccolo Launchpad 做电机控制的项目。现在遇到的问题是在调试时,主程序中无法调用isr中断函数。并且计数器IsrTicker一直为0, 不会增长。我把主程序粘贴在这里。调试是程序位置在flash闪存。
// Main Code
void main(void)
{
DeviceInit(); // Device Life support & GPIO
// Only used if running from FLASH
// Note that the variable FLASH is defined by the compiler
// (see TwoChannelBuck.pjt file)
#ifdef FLASH
// Copy time critical code and Flash setup code to RAM
// The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the linker files.
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash(); // Call the flash wrapper init function
#endif //(FLASH)
// Waiting for enable flag set
while (EnableFlag==FALSE)
{
BackTicker++;
}
// Timing sync for background loops
// Timer period definitions found in device specific PeripheralHeaderIncludes.h
CpuTimer0Regs.PRD.all = mSec1; // A tasks
CpuTimer1Regs.PRD.all = mSec5; // B tasks
CpuTimer2Regs.PRD.all = mSec50; // C tasks
// Initialize DATALOG module
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x064;
dlog.prescalar = 5;
dlog.init(&dlog);
// Initialize ADC module
AdcConfig ();
// Reassign ISRs.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.EPWM1_INT = &MainISR;
EDIS;
// Enable PIE group 3 interrupt 1 for EPWM1_INT
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
//PieCtrlRegs.PIEACK.bit.ACK3
//PieCtrlRegs.PIECTRL.bit.ENPIE
//PieCtrlRegs.PIEIFR3.bit.INTx1
// Enable CNT_zero interrupt using EPWM1 Time-base
EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable EPWM1INT generation
EPwm1Regs.ETSEL.bit.INTSEL = 1; // Enable interrupt CNT_zero event
EPwm1Regs.ETPS.bit.INTPRD = 1; // Generate interrupt on the 1st event
EPwm1Regs.ETCLR.bit.INT = 1; // Enable more interrupts
// Enable CPU INT3 for EPWM1_INT:
IER |= M_INT3;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// IDLE loop. Just sit and loop forever:
for(;;); //infinite loop
} //END MAIN CODE
请问这个程序有什么问题吗?为什么无法调用 interrupt void MainISR 函数??
谢谢!