Hi Brian,
It's NOT a typo. You can use all available interrupts simultaneously.
On any interrupt, the program flow will be directed to the single interrupt handler. Then it's up to you to determine which one fired.
Each interrupt source has 2 bit's associated with it. An Enable bit (*IE), and an Interrupt Flag (*IF). You need to look in the datasheet to find where those bit's are.
Then in the interrupt handler, check BOTH the enable bit and the interrupt flag to determine if a particular interrupt has triggered.
For example, to have the RB Port change and Timer1 interrupts, it might look something like this...hth,Code:RBIE VAR INTCON.3 RBIF VAR INTCON.0 TMR1IE VAR PIE1.0 TMR1IF VAR PIR1.0 TMR1ON VAR T1CON.0 OldBits VAR BYTE NewBits VAR BYTE OldBits = PORTB ; End the mismatch RBIF = 0 ; clear the flag RBIE = 1 ; enable PORTB change interrupts TMR1IF = 0 ; clear TMR1 interrupt flag TMR1IE = 1 ; enable Timer1 interrupts TMR1ON = 1 ; Start the Timer ON INTERRUPT GOTO INTHandler Main: PAUSEUS 20 GOTO Main DISABLE INTHandler: IF RBIE and RBIF THEN NewBits = PORTB ; end the mismatch RBIF = 0 ; clear the flag ; handle RB port change interrupt here OldBits = NewBits ENDIF IF TMR1IE and TMR1IF THEN TMR1IF = 0 ; clear the flag ; handle Timer1 interrupt here ENDIF RESUME ENABLE




Bookmarks