I'm trying to understand how interrupt works but after reading for a long time I'm getting very confused.
Let's say I have a c program and it has a main function and interrupt service routine. As I think the CPU gives control to the main function until the interrupt flag is set. As soon as the interrupt flag is set, cpu gives its control to the interrupt service routine.
I don't understand how the CPU takes control back to a main function where it left control. Why is it that the CPU takes control from where it was left?
Let's say I have a c program and it has a main function and interrupt service routine. As I think the CPU gives control to the main function until the interrupt flag is set. As soon as the interrupt flag is set, cpu gives its control to the interrupt service routine.
I don't understand how the CPU takes control back to a main function where it left control. Why is it that the CPU takes control from where it was left?
Last edited: