初始化函数:
void sInitHRcap(void) //add at 16:40 of 2014.1.16
{
EALLOW;
HRCap1Regs.HCCTL.bit.SOFTRESET = 1;
HRCap1Regs.HCCTL.bit.HCCAPCLKSEL = 1; //HCCAPCLK = PLLCLK = SYSCLK * 2
HRCap1Regs.HCCTL.bit.FALLINTE = 1; //Enable falling edge capture event interrupt
HRCap1Regs.HCCTL.bit.RISEINTE = 0; //Disable Rising Edge Capture Event Interrupt
HRCap1Regs.HCCTL.bit.OVFINTE = 0; //Disable interrupt on 16-bit Counter Overflow Event
EDIS;
}
中断函数:
interrupt void HRCAP1_INT_ISR(void)
{
GpioDataRegs.GPATOGGLE.bit.GPIO6 = 1; //add at 22:30 of 2014.1.16
EALLOW;
HRCap1Regs.HCICLR.bit.FALL=1; // Clear RISE/FALL flags
// HRCap1Regs.HCICLR.bit.RISE=1;
HRCap1Regs.HCICLR.bit.INT=1; // Clear HRCAP interrupt flag
PieCtrlRegs.PIEACK.bit.ACK4=1; // Acknowledge PIE Group 4 interrupts.
EDIS;
// Acknowledge this interrupt to receive more interrupts from group 2
PieCtrlRegs.PIEACK.all = PIEACK_GROUP4;
}
运行仿真只能进入一次中断,而且不易进入,求高手指点,谢谢!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>