Timer 0, mode 1 interrupt in 8051

shteii01

Joined Feb 19, 2010
4,644
Another question. I seldom use interrupts and therefore I'm no expert on them.

If I have two interrupt sources, say timer0 overflow, and external interrupt 0; and I use two separate routines to deal with each of them, will one routine be interrupted by the other? Or does that have to do with how interrupt priority is set up?
It is decided by interrupt priority.
You can change interrupt priority for interrupts.
The interrupt priority is set in IP register.

Higher priority interrupt can interrupt lower priority interrupt. It is called Interrupt Inside Interrupt.
 
Last edited:

shteii01

Joined Feb 19, 2010
4,644
In 8051 default interrupt priority is:
Highest: INT0
TF0
INT1
TF1
Lowest: RI+TI

So, yes, INT0, external interrupt 0, has absolute highest priority in default setup 8051 and nothing can interrupt it. But you can reprogram IP register and set a different interrupt to have highest priority.
 

JohnInTX

Joined Jun 26, 2012
4,787
For nested interrupts, the ability to swap general purpose register banks using RS1,RS0 in PSW is most helpful. Typical use is bank 0 for general processing and banks 1-3 for increasing interrupt priority levels.
 
Top