??? 03/30/10 15:50 Modified: 03/30/10 15:51 Read: times |
#174641 - Apart from missing reti... Responding to: ???'s previous message |
No, this is what I was alluding to. Look at the following code. When we hit the Timer ISR we get to the line that says "jnb finished,$ ;wait for complete event to finish". However, 'finished' is set in a different ISR (LightGate2:). Because we're already servicing the Timer interrupt we will never set 'finished', because you can't service an interrupt while you're already servicing an interrupt. That's why David's code won't go past that line.
Timer: mov TH0,#220 ; prepare timer registers mov TL0, #01 mov TMOD,#01H ;Timer 0 mode 1 clr TF0 ;clear timer interrupt flag mov timerOverFlow,#0 ;clear overflow counter setb EX0 ;enable external interrupt 0 setb ET0 ;enable timer interrupt 0 setb EX1 ;enable external interrupt 1 setb EA ;enable global interrupt jnb finished,$ ;wait for complete event to finish <---------PROBLEM LINE clr finished ;clear event bit sjmp Timer ;prepare for next event LightGate2: clr TR0 ;stop event timer setb finished ;event finished (finished is defined in 0h) reti |
Topic | Author | Date |
Timer Problem Assembly Code | 01/01/70 00:00 | |
Interrupt priorities... | 01/01/70 00:00 | |
Also... | 01/01/70 00:00 | |
The missing words | 01/01/70 00:00 | |
You sure? | 01/01/70 00:00 | |
many ways to skin a cat | 01/01/70 00:00 | |
Actually very relevant | 01/01/70 00:00 | |
My impression is | 01/01/70 00:00 | |
Interesting, but missing the point surely... | 01/01/70 00:00 | |
Interrupts are 'saved' | 01/01/70 00:00 | |
Soft interrupts | 01/01/70 00:00 | |
in a '51 forum | 01/01/70 00:00 | |
Still missing the point... | 01/01/70 00:00 | |
the missing reti's have already been mentioned | 01/01/70 00:00 | |
Apart from missing reti...![]() | 01/01/70 00:00 | |
Interupt priorities | 01/01/70 00:00 |