Hi, I need some more information regarding the interrupts priorities in 8051. If a low priority interrupt occurs while a high/low priority interrupt service routine is running, Is the low priority interrupt that occured is lost and won't be handled after the running ISR is completed? While EA=0(all interrupts disabled)and an interrupt occures,is it lost?which means does the uPSD remebers the interrupt activation and jumps to its ISR after EA is set? Is it important if the interrupt that occurs while EA=0 is a high or low priority interrupt? If all interrupts are with the same priority ,does in this case servicing the interrupts is based only on the priority level chart?which means will interrupt ext0 be serviced before timer0 for example(in case both arrive at the same time)? Thanks .
http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf erik
No, you won't lose any interrupts. If a low priority interrupt becomes pending while a high priority ISR (Interrupt Service Routine) is executing, then, when the high priority ISR executes RETI, the CPU will return to the main program, execute a single instruction and then be vectored off to the low priority ISR. (Some caveats apply). While all interrupts are disabled, it is still possible for interrupts to become pending. Just as soon as the global interrupt enable is set, the CPU will be vectored to the ISRs of the pending interrupts following the usual rules. It is often useful to use EA to turn off all interrupts for a short, but timing critical, function executed in main. When EA is turned on again, all pending ISRs will be executed. If there are pending interrupts of the same priority then, when the CPU is free to invoke an ISR, it will be vectored to the ISR of the pending interrupt that has the highest "within priority" level - ie the order in which they appear on the chart. Note that the order in which the interrupts became pending is NOT important.
Thanks. Regarding the case that EA=0, if all interrupts invoke simultanisely while EA=0 and will become pending,will they all be serviced (according to the priorities) after EA is set?
yes, but once only Erik