DarrelsRBCINTSetup

Darrel Taylor
14-Feb-2008

Code:
Old_Bits VAR BYTE
New_Bits VAR BYTE

INCLUDE "DT_INTS-18.bas"        ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas"     ' Include if using PBP interrupts

ASM
INT_LIST  macro    ; IntSource,         Label,  Type, ResetFlag?
        INT_Handler    RBC_INT,  _RBC_handler,   PBP,  yes
    endm
    INT_CREATE               ; Creates the interrupt processor
ENDASM

Old_Bits = PORTB
@    INT_ENABLE   RBC_INT     ;RB Port Change Interrupt

Main:
  Pause 1000
GOTO Main

'---[RBC - interrupt handler]---------------------------------------------------
RBC_handler:
    New_Bits = PORTB
    IF (New_Bits.4 <> Old_Bits.4) THEN
        ; -- PORTB.4 has changed -- 
    ENDIF
    IF (New_Bits.5 <> Old_Bits.5) THEN
        ; -- PORTB.5 has changed -- 
    ENDIF
    Old_Bits = New_Bits
@ INT_RETURN

Page last modified on March 08, 2018, at 10:33 PM