Nesting interrupts in 8051

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 ?

Reply to
mahna.rakesh
Loading thread data ...

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.

Reply to
Tamilmaran S

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

Reply to
Noone

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.