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.

430进出中断的时间



16M晶振,msp4305418单片机,进出中断耗时多少微妙!

  • 你仿真测量一下消耗的时钟数吧

  • 这个可以通过仿真测量,或者看生成的汇编代码也可以

  • 汇编指令转成机器指令的不定,仿真有一定的误差吧,要是有实测的就最好了!

  • 仿真和实际运行的指令周期应该是一样的,当然,前提是你的代码位置相同

  • Fengtao,

    响应中断总cycle数 = 完成中断产生时的正在执行的指令(1--10个 cycle) + 6 cycle (进入中断) + ISR执行时间 +   5 cycle (退出中断)

    进入中断(6 cycle)和退出中断(5 cycle)的时间是固定的。用16Mhz MCLK,纯粹的进出中断耗时<1uS. 

    Regards,

    Jason

  • 你好,

    非常感谢你的回答,如果考虑入栈和出栈的时间,大概需要多少时间,谢谢!

  • 你说的堆栈入栈都已经包括在 这 6 +5 = 11个cycle中了

    进入中断的6 个cycle做了下面的事情

    The interrupt latency is six cycles, starting with the acceptance of an interrupt request, and lasting until the
    start of execution of the first instruction of the interrupt service routine, as shown in Figure 1-4. The
    interrupt logic executes the following:
    1. Any currently executing instruction is completed.
    2. The PC, which points to the next instruction, is pushed onto the stack.
    3. The SR is pushed onto the stack.
    4. The interrupt with the highest priority is selected if multiple interrupts occurred during the last
    instruction and are pending for service.
    5. The interrupt request flag resets automatically on single-source flags. Multiple source flags remain set
    for servicing by software.
    6. All bits of SR are cleared except SCG0, thereby terminating any low-power mode. Because the GIE bit
    is cleared, further interrupts are disabled.
    7. The content of the interrupt vector is loaded into the PC; the program continues with the interrupt
    service routine at that address.

    退出中断的5个cycle做了下面的事情,

    The return from the interrupt takes five cycles to execute the following actions and is illustrated in
    1. The SR with all previous settings pops from the stack. All previous settings of GIE, CPUOFF, etc. are
    now in effect, regardless of the settings used during the interrupt service routine.
    2. The PC pops from the stack and begins execution at the point where it was interrupted.