my_isr(){
do{
interrupt_found = 0;
// check all interrupt sources and set interrupt_found = 1 if an interrupt is found and processed
}while(interrupt_found);
}
Since the system detects interrupt only when a negative edge is detected in the interrupt line, the new interrupt will be missed. How does a system handle this situation?
I think it should be clear that one need to read/know the source of the interrupt. Otherwise you can't run the corresponding code.If you simply gate several interrupt sources, you will not be able to identify the source
Not always - it depends on the MCU. For example, Microchip PIC18 and lower families have one and perhaps 2 interrupt levels. Where there is a single interrupt, then all interrupt sources have the same 'priority'. When you have 2 levels, then you can assign each interrupt source a priority which means the timer can be assigned a low priority of you want it to be that way.e.g., timer interrupts are given high priority always.
while(interrupt is set)
{
clear interrupt; // Do this right at the start
process interrupt;
// Allow for the fact that the interrupt could have been re-triggered by looping back...
}
Question: how can you write code for a microprocessor when you don't know what it is?
Regardless, one thing you could do in the ISR is along the lines of the following pseudo-code:
Code:while(interrupt is set) { clear interrupt; // Do this right at the start process interrupt; // Allow for the fact that the interrupt could have been re-triggered by looping back... }
Masking out interrupts enables the system to miss interrupts, thus you should not do this.
But this exactly I see as the problem.This ensures that new interrupt reception does not happen before the main interrupt line is set back high.
If it's masked out you don't recognize the interrupt, thus you may miss it.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?