What happens when an interrupt occurs when using an MCS 251 microcontroller?
A typical interrupt event chain occurs as follows. An internal or external device initiates an interrupt request signal. This signal, connected to an input pin and periodically sampled by the MCS 251 microcontroller, 8xC251SX, latches the event into a flag buffer. The interrupt handler compares the priority of the flag to the priority of other interrupts. A high priority causes the handler to set an interrupt flag. This signals the instruction execution unit to execute a context switch. This context switch breaks the current flow of instruction sequences. The execution unit completes the current instruction prior to a save of the program counter (PC) and reloads the PC with the start address of a software interrupt service routine (ISR). The software service routine executes assigned tasks and, as a final activity, performs a RETI (return from interrupt) instruction. This instruction signals completion of the interrupt, resets the interrupt-in-progress priority, and reloads the program