Originally Posted by
skimask
General code flow when using ON_INTERRUPT's...(you mileage may vary, others do it other ways, I do it this way)...
1) resetplaceholder: 'just a placeholder
2) ------DEFINEs needed thru the program
3) DISABLE 'need to disable interrupts while actually processing an interrupt
4) CLEAR
5) ------any eeprom data, variable definitions, etc.
6) ------macro's you might be using
7) startupholder: goto skipsubs 'skip over all the commonly used subroutines
8) ON INTERRUPT GOTO INTHANDLER
9) INTHANDLER: 'process your interrupts.
10) 'check the interrupt bits, if the interrupt you want is active, reset the bit and process it
11) INTFINISH: 'I usually recheck the interrupt sources. If one of them tripped while I was processing a previous interrupt, I go back and re-process the interrupt
12) INTRESUME: RESUME 'resume AFTER you've processed the interrupt
13) 'commonly used subroutines start below here
14) commonly_used_sub_1: 'do something here and return from it
15) ..........
16) 'end of commonly used subroutines, skipsubs block for setting up registers, lcd, whatever
17) skipsubs: 'set up the PIC as required
18) mainloop: 'the main program runs here waiting to get interrupted
19) ------------more program stuffed in here.........
20) goto mainloop
21) END