Concept Flow - Writing an ISR (Interrupt Service Routine)
Interrupt Occurs
CPU Pauses Main Code
Jump to ISR Function
Execute ISR Code
Clear Interrupt Flag
Return from ISR
Resume Main Code Execution
When an interrupt happens, the CPU stops the main program, runs the ISR code to handle the event, then returns to the main program.