| ??? 04/05/00 01:27 Read: times |
#2084 - RE: Interupts not working |
The other thing that is causing a problem is that your interrupt routine is not protecting the state of registers in foreground.
For example, you may be in the middle of a turn function when an INT0/ is triggered by a contact bumper signaling that you should use the interrupt to back up. Ok. But the values of the R0 register, the PSW flags, and even port signal levels will have changed when the interrupt returns to the next line in foreground code. The structure of the INT0/ interrupt may not be optimum as I suspect there are bigger issues integrating the backup condition with anything running in non-interrupt. But aside from that, you should put the following code at the beginning and end of the interrupt service routine: ;before interrupt changes anything . PUSH PSW ;save fgnd cy and flags . PUSH ACC ;save fgnd accumulator . PUSH R0 ;save fgnd R0 . PUSH R1 ;save fgnd R1 . CLR IE0 ;reset the interrupt cond. ;insert interrupt code between here. ;after the interrupt and before RETI: . POP R1 . POP R0 . POP ACC . POP PSW . RETI You probably need to clear the interrupt flag signalling the INT0/ interrupt condition too. I wrote it above as CLR IE0... but I dont have my documentation here... so you'll have to find the right bit to clear. Looks like a fun project! -Jay C. Box |
| Topic | Author | Date |
| Interupts not working | 01/01/70 00:00 | |
| RE: Interupts not working | 01/01/70 00:00 | |
| RE: Interupts not working | 01/01/70 00:00 | |
| RE: Interupts not working | 01/01/70 00:00 | |
| RE: Interupts not working | 01/01/70 00:00 | |
| RE: Interupts not working | 01/01/70 00:00 | |
RE: Interupts not working | 01/01/70 00:00 |



