ExampleByCharlesLinquis

Charles Linquis
23-Aug-2011

Yes, I know, it uses DT_INT-18 but that shouldn't be a problem in this case.



  PreloadH      VAR BYTE BANKA SYSTEM
  PreloadL       VAR BYTE BANKA SYSTEM
  MasterClock   VAR WORD BANKA SYSTEM
  ButtonFlag    var BYTE BANKA SYSTEM


  PreloadH= $D8
  PreloadL = $F7    ; 1 [email protected]

  T0CON = %10001000  ; Timer ON, no prescaler


'---------------------------------- --------------------------------  

        INCLUDE "DT_INTS-18.bas"         

'        INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts

ASM
INT_LIST  macro    ;IntSource,        Label,  Type, ResetFlag?

     INT_Handler    TMR0_INT,   MainTimer, ASM,  yes 
; INT_Handler    RX1_INT, GetChar,    PBP,  yes

endm

INT_CREATE               

ENDASM

Goto OverInt


'---[INT - interrupt handler]---------------------------------------------------

Asm                            

MainTimer

    movff    PreloadH,TMR0H  ; Preload depends on clk speed
    movff    PreloadL,TMR0L
     clrf     INTCON,2

     infsnz  MasterClock
     incf    MasterClock + 1

     btfss  PORTC,4
     bsf  ButtonFlag,0

@ INT_RETURN

ENDASM      

OverInt:

   ButtonFlag = 0
   MasterClock = 0
   INTCON =%11100000  ; just to be certain!

@ INT_ENABLE TMR0_INT  


Your program here
Page last modified on March 09, 2018, at 12:02 AM