This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123 外部中断例程

自己按照Tiva写的总会进入DefaultIntHandler

  • 贴你的代码上来。你说的外部中断,指的是GPIO中断吧,可以参考C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\interrupts线的代码,例程中就是展示了GPIO中断。
  • 建议您附上代码或者再详细说明您的问题,谢谢
  • /* PE4 */
    void exit_init(void)
    {
    /* problem unsolved */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    GPIODMATriggerEnable(GPIO_PORTE_BASE,GPIO_PIN_4);
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_4);
    GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);
    GPIOIntTypeSet(GPIO_PORTE_BASE, GPIO_PIN_4 , GPIO_RISING_EDGE);
    GPIOIntRegister(GPIO_PORTE_BASE, uDMAIntHandler);
    GPIOIntEnable(GPIO_PORTE_BASE, GPIO_PIN_4);
    IntEnable(INT_GPIOE);
    }

  • 启动函数中添加中断函数了没?
  • //*****************************************************************************
    //
    // This is the code that gets called when the processor receives an unexpected
    // interrupt.  This simply enters an infinite loop, preserving the system state
    // for examination by a debugger.
    //
    //*****************************************************************************
    static void
    IntDefaultHandler(void)
    {
        //
        // Go into an infinite loop.
        //
        while(1)
        {
        }
    }

    进入IntDefaultHandler是因为收到了意外中断

    建议您加上IntMasterEnable();然后在中断服务程序内加断点调试一下,看能否进入中断