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.

如何在cpsr中使能IRQ和FIQ?

Other Parts Discussed in Thread: HALCOGEN

一个很简单的程序,我把GIOA【2】定义为 外部中断,想通过它调用相应的中断程序,我用halcogen初始化了  GIO  和VIM,当我运行程序的时候发现了

2个问题:

1. CPSR【6】,CPSR【7】没有被清0,我只有手动清0程序才能进入ISR,资料上说用swi可以修改,请问能够在程序配置好后清除cpsr【6】和cpsr[7]的具体方法?

2.当程序编号后,我单步运行程序,发现在单步运行时,即使所有的中断条件都满足,程序也不能跳进ISR,我用的是CCS5.3,请问这种情况是否正常?

 

附件是我的工程

2_570gio_IRQ.zip
  • LC:

      你好,

         我刚看过了你的主程序,你需要在使能GIO模块后,加上一句_enable_IRQ();或是_enable_FIQ();来使能IRQ中断或是FIQ中断。

    你可以先试一下,有什么问题再继续交流。

    谢谢

    Ken Wang

  • Ken Wang :

                     我加上了这两句,cpsr[6]被清0了,谢谢!
         不过我在工程里没搜索到这两个函数,请问是否有这类函数的比较详细的介绍?
         此外,我还有一个问题,在程序调试的时候,如果采用“step into ”或者“step over”调试,即使中断标志被置位,程序也不能跳进ISR中,而只在main()中运行,但是我在ISR中设置1个断点,并让程序直接运行,发现程序在这种情况下可以进入ISR。我在TRM上的12.4.1上看到在“Emulation Mode”下,“External interrupts are not captured because the M3VIM is unable to service interrupts.”  这是否指的是这种情况?
    我用的是TMS 570MDK和CCS5.3,请问这种情况是正常的吗?
  • LC:

       你好,

          这类的函数都是在我们编译器的real time library里的,在工程里是搜不到的。下面有几个相关函数的介绍,仅供参考:

    • _enable_IRQ() to enable only IRQ interrupt.
    • _enable_FIQ() to enable only FIQ/NMI interrupt.
    • _enable_interrupts() to enable both IRQ and FIQ/NMI interrupts.
    • _disable_IRQ() to disable only IRQ interrupt.
    • _disable_FIQ() to disable only FIQ/NMI() interrupt. NOTE: This is not applicable on HERCULESTM microcontrollers.
    • _disable_interrupts() to disable both IRQ and FIQ/NMI interrupts. NOTE: on HERCULESTM microcontrollers, this intrinsic code will only disable IRQ interrupt.

    另外关于你调试中断的过程中遇到的问题,我也遇见过,一般调试的时候,也都是直接在ISR的程序里设断点,然后直接运行。

    Ken Wang