InitSysCtrl();
EALLOW; //允许访问受保护的空间
GpioCtrlRegs.GPADIR.bit.GPIO1=1;
GpioDataRegs.GPADAT.bit.GPIO1=1;
EDIS;
InitECap1Gpio();
InitECapture();
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.ECAP1_INT = &ecap1_isr;
EDIS; // This is needed to disable write to EALLOW protected registers // Enable CPU INT4 which is connected to ECAP1-4 INT:
IER |= M_INT4;
PieCtrlRegs.PIEIER4.bit.INTx1 = 1;
// Enable eCAP INTn in the PIE: Group 3 interrupt 1-6
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
while(1);
}