Am using DT_INTS with 18F4550 to detect an alarm interrupt on INT2 from DS1330 real-time-clock. So that I can reuse a tested routine for operating the clock and a SRF02 peripheral via I2C bus, I adapted it into an INCLUDE file as a callable routine from the Main program. The INCLUDE processes the clock/SRF02 operations and provides results via global variables to the Main program. The program compiles and assembles OK without any errors in either the Main or INCLUDE file. However, when the program runs, I get continous interrupts that continuously trigger the Alarm handler in the INCLUDE file. I had seen this problem in previous versions and solved it (without understanding why) by placing a PAUSE 100 at beginning of the Main program. This previous fix didn't work in this case.
I am posting the applicable code from my Main program below. Can anyone tell me why it would create continuous INT2 interrupts??
Code:
''----------------[ Define Include Files & special DEFINES ]
INCLUDE "DS1337_SRF02.inc"  ' Include use of DS1337_SRF02 Alarm handler
INCLUDE "Modedefs.Bas"
INCLUDE "DT_INTS-18.bas"    ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP high priority interrupts
INCLUDE "ALLDIGITAL.pbp"    DEFINE OSC 16

DEFINE I2C_SLOW 1   ' Set i2c to the standard speed
DEFINE I2C_HOLD 1   ' Enable recieving i2c device to pause communication

'--------------[ Declare Variables, Aliases & Constants ] 
' Global variables & constants used in both Main program and Include files
    'rng0     VAR w0.Byte0  ' LSB of range measurement when right justified
    'rng1     VAR w0.byte1  ' MSB of range measurement when right justified 
    'SCL      VAR PORTB.1   ' I2C clock pin 
    'SDA      VAR PORTB.0   ' I2C data pin
    'w0       var word      ' W0 is the word value to store the range data
    'rtcdevice CON $D0  ' Device address for DS1337 Real-time-clock (RTC)
    'srfdevice CON $E0  ' Device address for SRF02 ultrasonic range finder
    'Alarm1      VAR PORTB.2     ' Alarm1 input from DS1337 INTA (pin-3)
    'Alarm2      VAR PORTB.3     ' Alarm2 input from DS1337 INTB (pin-7)
    'RTC_INT_FLG  VAR INTCON3.1 'Alias for RB2 INTA interrupt flag from RTC
' Clock Variables
    'sec         VAR BYTE  ' seconds 
    'MINs        VAR BYTE  ' minutes 
    'hr          VAR BYTE  ' hours 
    'day         VAR BYTE  ' day 
    'date        VAR BYTE  ' date 
    'mon         VAR BYTE  ' month 
    'yr          VAR BYTE  ' year 
' ALARM1 VARIABLES
    'A1sec       VAR BYTE  ' seconds 
    'A1MINs      VAR BYTE  ' minutes 
    'A1hr        VAR BYTE  ' hours 
    'A1day       VAR BYTE  ' day     
' ALARM2 VARIABLES
    'A2MINs      VAR BYTE  ' minutes
    'A2hr        VAR BYTE  ' hours
    'A2day       VAR BYTE  ' day

GoSub SetTimeAndDate        ' Setup current time & alarm settings

'----------------------[ SETUP FOR INTERRUPTS ]  
ASM
INT_LIST  macro    ; IntSource,         Label,  Type, ResetFlag?
        ;INT_Handler   USB_Handler
        INT_Handler   INT2_INT,        _AlarmHdlr,   PBP,  yes
    endm
    INT_CREATE                ; Creates the interrupt processor
ENDASM
@    INT_ENABLE   INT2_INT     ; enable external (INT) interrupts

' Per DT, DT_INTS already takes care of setting INTCON and RCON registers
' but this doesn't work unles INTCON2 set per below:
    'INTCON.7 = 1         ' Set Global Interrupt Enable bit
    INTCON2 = %00000000  ' Set INT2 for falling edge (Bit4-low)
                         ' on RTC's interrupt.
    'INTCON3 = %10010000  ' Set INT2 high priority (Bit7-high), enable INT2
                         ' (Bit4-high)

' Initialize Hardware 
    'Set registers
      'OSCCON.7 = 0          ' Clear IDLEN bit to allow SLEEP mode
      ' According to data sheet, must clear CONFIG2H.0 (WDTEN bit) 
      ' in order to use WDTCON. Not clear from Data sheet how to reach 
      ' WDTEN bit with with config fuses??
      'WDTCON.0 = 1          ' Set SWDTEN bit to turn on WDT
      TRISA = 0             ' PORTA all outputs for LCD use              
      TRISB =%00001100      ' RB2 & RB3 set as RTC Alarm1 & Alarm2 inputs 
      TRISC = 0      
      TRISD = 0 
      TRISE = 0
      
'--------------------[ Begin Main Program Loop ]
Main:
    PAUSE 100     ' ?? For some reason this 100 millisec delay has been 
                   'required in previous versions
                  ' to keep RTC interrupts from happening every 11 secs ??  
    Low PORTC.0   ' Turn off Test LED while in Main loop       
             
    GoTo Main     ' Endless Loop waiting for interrupt
End     ' Safety measure to insure program stops if reaches here

'-------------------[ Begin Interrupt Handler }-----------------------
AlarmHdlr:
    Goto Alarm     ' Call Alarm handler subroutine in INCLUDE file
@ INT_RETURN