| ??? 06/03/01 11:44 Read: times |
#12149 - Interrupt service routine |
Hello everybody!
I have a question about interrupt routine. I have been using two interrupts in my program, external int.1 & 2. Inputs are conected to the same signal int1-direct,int0-via inverter. So, at the beginning of the program I set: ;timer 0 is in timer mode,software controll MAIN: CLR after_ex0 CLR after_ex1 SETB EX1 ;external int.1 enable CLR EX0 ;external int.0 disable SET EA ;global interrupt enable JNB after_ex1,$ ;wait for int.1 service routine end JNB after_ex0,$ ;wait for int.0 service routine end CALL display_results and my program is waiting for 1 to 0 transistion on INT1. Interrupt 1 service routine is setting only four bits (so as int.0): IRQEX1: SETB TR0 ;starts timer 0 CLR EX1 ;int.1 disable SET EX0 ;int.0 enable SET after_ex1 RETI IRQEX0: CLR TR0 ;stops timer 0 CLR EX0 ;int.0 disable SET after_ex0 RETI My questions is: can I clear EX1 bit during interrupt service routine? Program should measure the low pulse using timer 0. The results of measuring are so amazing - I calculate the input pulse and its duration would be about 380 machine cycles, but the results of measuring is... 12. I have made changes and now, my program looks like below: MAIN: CLR after_ex0 CLR after_ex1 SETB EX1 ;int.1 enable CLR EX0 ;int.0 disable SET EA JNB after_ex1,$ CLR EX1 ;int.1 disable SETB EX0 ;int.0 enable JNB after_ex0,$ CLR EX0 ;int.0 disable CALL display_results IRQEX1: SETB TR0 ;starts timer 0 SET after_ex1 RETI IRQEX0: CLR TR0 ;stops timer 0 SET after_ex0 RETI And the results are diffrent (about 30 times!!!). Why? I can evaluate the problem myself, but at this moment I haven\'t my ICE. Could anybody answer my question? |
| Topic | Author | Date |
| Interrupt service routine | 01/01/70 00:00 | |
| RE: Interrupt service routine | 01/01/70 00:00 | |
RE: Interrupt service routine | 01/01/70 00:00 |



