Forums

Nesting interrupts in 8051

Started by Unknown February 21, 2006
If the 8051chip is servicing a lower priority interrupt and I want it
to be interrupted by a higher priority interrupt, do I have to enable
interrupts - EA = 1 - as sson as I enter lower priority ISR. In other
words, does the 8051 disables all interrupts when it enters an ISR ?

No, actually when it enter into a ISR, then it will disable all the
interrupt which are having priority level lower and equal than that.

mahna.rakesh@gmail.com wrote:

> If the 8051chip is servicing a lower priority interrupt and I want it > to be interrupted by a higher priority interrupt, do I have to enable > interrupts - EA = 1 - as sson as I enter lower priority ISR. In other > words, does the 8051 disables all interrupts when it enters an ISR ?
Unless some other requirement necessitates it, you can leave EA set when interrupts are used. No need to disable EA when in an ISR. That way, if a high priority interrupt becomes active, you can service it. The 8051 only allows one interrupt of each type to be active at any one time. Thus a high priority interrupt can interrupt a low priority interrupt. All interrupts at the same priority have to wait until the current interrupt of that priority is complete. Be very careful to ensure that your machine environment is preserved. Not every interrupt routine needs to preserve everything. Some things like timer interrupts can be written so as to not require state preservation. Blakely