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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/21/02 06:10
Read: times


 
#21986 - Interrupts, are they really a mystery ?
Hi,

I am well screwed up on interrupts.

I have the following in my code:

SETB EXO
SETB IT0
CLR PX0 ; LOW PRIORITY

SETB EX1
SETB IT1
SETB PX1 ; HIGH PRIORITY

SETB EA

SJMP MAIN

ORG 0003H ; VECTOR FOR EX0
.........
.........
CALL EX0_ISR
.........
CLR IE0
RETI


ORG 0013H ; VECTOR FOR EX1
.........
.........
.........
CALL EX1_ISR
.........
CLR IE1
RETI


ORG 0050H

MAIN
...
...
...
...
...
.....

SJMP $ ; WAIT FOR AN INTERRUPT


EX0_ISR
.....
RET


EX1_ISR
.....
RET

<<<< PROBLEM >>>>


interrupt ex1 has higher priority.

at times ex0 stops responding and ex1 keeps working.


<<<< SOLUTION >>>>


changing ex0 and ex1 codes as below:


ORG 0003H ; VECTOR FOR EX0
CLR IE0
.........
.........
CALL EX0_ISR
.........
RETI


ORG 0013H ; VECTOR FOR EX1
CLR IE1
.........
.........
.........
CALL EX1_ISR
.........
RETI

<<<<<< >>>>>>

just by changing the line number of interrupt clearing flags from last to first, it solved the problem.



I DO NOT KNOW WHY IT SOLVED, I JUST HIT IT BY CHANCE IF IT IS THE RIGHT SOLUTION.


My book says IE0 and IE1 are cleared by automatically.


Your review and comments are appreciated please.


Simon



List of 11 messages in thread
TopicAuthorDate
Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: In the actual code, Gallo:            01/01/70 00:00      
RE: In the actual code, Gallo:            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a mystery ?            01/01/70 00:00      
RE: Interrupts, are they really a myster            01/01/70 00:00      
RE: In the actual code, Gallo:            01/01/70 00:00      

Back to Subject List