cpu中断机制

When an interrupt gets active, the microcontroller goes through the following steps −

  • The microcontroller closes the currently executing instruction and saves the address of the next instruction (PC) on the stack.

  • It also saves the current status of all the interrupts internally (i.e., not on the stack).

  • It jumps to the memory location of the interrupt vector table that holds the address of the interrupts service routine.

  • The microcontroller gets the address of the ISR from the interrupt vector table and jumps to it. It starts to execute the interrupt service subroutine, which is RETI (return from interrupt).

  • Upon executing the RETI instruction, the microcontroller returns to the location where it was interrupted. First, it gets the program counter (PC) address from the stack by popping the top bytes of the stack into the PC. Then, it start to execute from that address.

猜你喜欢

转载自www.cnblogs.com/lnas01/p/10326409.html
今日推荐