204k views
4 votes
The "persistent interrupt" is a bug in the code that exhibits a behavior that’s similar to an infinite loop. The ISR exits and gets called back immediately an infinite amount of times even though the interrupt event occurred once. The persistent interrupt occurs when three conditions are met. What are these conditions? How do we avoid a persistent interrupt from occurring?

User Mlp
by
6.3k points

1 Answer

6 votes

Answer:

1. the 3 conditions have been listed below

2. to avoid persistent interrupt, we break any of the 3 conditions.

Step-by-step explanation:

The persistent interrupt occurs when these three conditions below are met.

They are as follows:

1. GIE=1

2. xIE=1

3. xIFT=1

in avoidance of the persistent interrupt from occurring, we break any of these 3 conditions that I have listed above.

in order To break any one of the 3 conditions, we clear the flag that corresponds to the associated

we can also avoid the persistent interrupt occurrence by having the Interrupt Service Routine (ISR) clear maybe one or all of the three bits mentioned above before the ISR terminates, so it wouldn't get called back again. clearing any of the bits will not allow the ISR to be called again.

User Ninefifteen
by
5.2k points