| ??? 01/21/00 14:29 Read: times |
#1272 - RE: using the external interrupt |
Hi Babar,
there is only 1 way to interrupt an interrupt by itself: You must execute a RETI (e.g. call a subroutine, which was finished with RETI) and then terminate the interrupt by a RET. E.g. this is useful by counting 1ms by a timer interrupt and only some times you must do things, which need longer than 1ms (e.g. handle alarm events, calculating date ...). On external interrupts which are level triggered, every time, if you finish the interrupt by RETI and the level was still low, 1 instruction of the main program was executed and than the interrupt was reentered. This was also described in some 51 data books as a way for single step execution. On transition triggered interrupts the interrupt flag was cleared during the jump to the interrupt vector. But if during execution of the interrupt handler a 2. transition (high to low) occur, the flag was set again and causes also a reentering after RETI + 1 main program instruction. If you want it not, you must clear the interrupt flag before executing the RETI. Also if an interrupt was interrupted by an interrupt of higher priority the 1. RETI tell the CPU, that the higher priority interrupt was finished and then the 2. RETI finish the low priority interrupt. If you change the priority inside the interrupt, it must first be finished before the new priority was effective (I think so). To avoid other reaction on different 51 derivates you should change the priority immediately before the RETI. Since every write access to IE or IP cause, that the next instruction was executed before any interrupt source was sampled. This means, an instruction e.g. "MOV IP, #1" and the following instruction can not be interrupted. See at: http://www.specs.de/~danni/appl/hard/dvm/dvm.htm for an example with changing priority. Peter |
| Topic | Author | Date |
| using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
| RE: using the external interrupt | 01/01/70 00:00 | |
RE: using the external interrupt | 01/01/70 00:00 |



