Old dogs can learn new tricks, it just takes a little more effort. Can someone please tell me why the RB0 interrupt only works once on this simple routine? This is my first attempt at DT_INT’s. Once I got MPASM set up on MCSP I thought it would be easy. I’m using X1 board with 16F877A and pulsing RB0 with a wire lead. It runs the leds once then will not run again. I’ve tried everything I can think of with no success.
Code:
define osc 20
    option_reg.6=1 'rising pulse
    wsave   var byte $70  system
    wsave1  var byte $A0  system
    wsave2  var byte $120 system
    wsave3  var byte $1A0 system
    i       var byte
    LEDS    Var PORTD   ' Alias PORTD to LEDS
    TRISD = %00000000       ' Set PORTD to all output
INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
ASM
INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
        INT_Handler    INT_INT,  _ToggleLED1,   PBP,  yes
    endm
    INT_CREATE               ; Creates the interrupt processor
ENDASM
@   INT_ENABLE   INT_INT     ; enable external (INT) interrupts
Main:
  PAUSE 1
  PortD=0
  GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:  LEDS = 1        ' First LED on
        Pause 500       ' Delay for .5 seconds
        For i = 1 To 7  ' Go through For..Next loop 7 times
                LEDS = LEDS << 1        ' Shift on LED one to left
                Pause 500       ' Delay for .5 seconds
        Next i      
@ INT_RETURN
      end