Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/18/01 11:47
Read: times


 
#10936 - RE: Ex0 interrupt within Ex0 interrupt.
Hi all,

Interrupt cannot occur while its ISR is still being served. Therefore disabling EX0 interrupt during its ISR and enabling it before RETI won't help. However, clearing the interrupt flag in the ISR always help. Right ???

The EX0 ISR in my code is only 3 lines of assembly. Look at the code:

=============
org 0003h

call Ex0_ISR
clr IE0
RETI
=============


=============
org 0050h

Ex0_ISR

clr LED

Bla
bla
bla
.
.
.
.

Call Sub_XX ; this was causing problem.

Ret
=============

The Ex0 interrupt is caused from an input from an extenal hardware by going low with a switch.

The Sub_XX subroutine in the ISR of Ex0 interrupt pulls this input back to high.

However Sub_XX is taking long to return after pulling the input high.

Now if the after the Sub_xx has pulled the input high and is busy and at this instance the input again goes low (Ex0 pin low) then Sub_XX will not pull it back to high again because it has already done it at the start of it.

So, at the end of the ISR the input is low (Ex0 Pin is low) even after RETI.

There was a long gap between the line that pulls the input high in the Sub_XX and RETI.

So, as the interrupt is edge type so it does not encounter any high to low transition after ISR so the interrupt never occurs again. It gives an impression as the system has crashed.

I have resolved the problem by putting the line in Sub_XX that pulls the input (Ex0 pin) back to high, at the end of the subroutine.

So now there is a gap of only microseconds between that line of Sub_xx and RETI. This gap is now smaller than the gap between two interrupts from the fastest switching.

Result:
The EX0 pin is always high after RETI, to get a transition for interrupt. So it always responds to the switching.


Simon

List of 9 messages in thread
TopicAuthorDate
Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      
RE: Ex0 interrupt within Ex0 interrupt.            01/01/70 00:00      

Back to Subject List