How interrrupts are handled (works) ? (internally)

Hi,

I have a fundamental question of how interrupts in uC/uPs actually works? Many tell what happens when interrupts occur , like the program flow changes from the main program to ISR. But how exactly this happens without the interference of CPU?

What I understand is interrupt gets the attention of CPU without CPU keeping watch over Interrupt Signal. How is this done. I hope interrupt can wake up a CPU(in sleep mode).

I am confused !?! Please help

regards, Visweswara

Reply to
visweswara
Loading thread data ...

read your text book about computer organization.

interrupt can wake up a CPU, but it will take a long time to wake up a sleeping CPU.

But how exactly this happens

you should say "without the interference of program".

visweswara wrote:

Reply to
dick

The interrupt gets the attention of the CPU without the *software* keeping watch over the interrupt signal.

An interrupt is an input pin on the uP. Generally, when the CPU finishes executing the current instruction, it checks the status of the interrupt pin. If an interrupt is pending (active), the internal CPU logic causes the program counter to be loaded with the (appropriate) interrupt service routine address (vector) rather than the next instruction. This is how the software gets control on an interrupt without "watching" for the interrupt.

When you're done servicing the interrupt, you return from the interrupt routine and the CPU continues execution at the point it was interrupted.

Of course, there are numerous variances, complications, exceptions etc based on the multitude of processors out there - but that's the gist of it.

That explanation should get you 4/5 at least!?!

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, 
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
Reply to
Mark McDougall

Mark,Thank you very much for your reply.

That means CPU much keep watch over the interrupt pin after every instruction execution ? Then what is the advantage of interrupt over input pin polling. (are they same or diffrent).

Regards, Visweswara R

Reply to
visweswara

It is polling an input pin but the difference is that it is done in the processor hardware as part of the fetch operation instead of being requested as a software operation.

This polling method is fine because it is as fast as it can practically be and means that a currently executing instruction is not corrupted but that the interrupt is spotted before the next instruction is started.

Reply to
Tom Lucas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.