中断的一般方法 步骤 1 void InitPieCtrl(void) //初化 PIE 控制寄存器 { DINT; //关闭所有 CPU 标准中断Disable Interrupts at the CPU level: PieCtrlRegs
PIECTRL
ENPIE = 0; // 关闭所有 PIE 中断Disable the PIE // Clear all PIEIER registers: 清除所有中断使能位 PieCtrlRegs
PIEIER1~ 12(省了中问部分)
all = 0; // Clear all PIEIFR registers: 清除所有中断标志位 PieCtrlRegs
PIEIFR1~ 12
all = 0; } 步骤 2 // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; 步骤 3 初始化中断向量表 void InitPieVectTable(void) { int16 i; Uint32 *Source = (void *) &PieVectTableInit; Uint32 *Dest = (void *) &PieVectTable; EALLOW; for(i=0; i < 128; i++) *Dest++ = *Source++; EDIS; // Enable the PIE Vector Table PieCtrlRegs
PIECTRL
ENPIE = 1; } //下面这个原中断数据地向量位置 const struct PIE_VECT_TABLE PieVectTableInit = { PIE_RESERVED, // 0 Reserved space PIE_RESER