DT_INTS-14    (Blinky Light)


The ultimate overkill Blinky Light program ... using Timer 1
Example 2:
LED1   VAR  PORTB.1

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   TMR1_INT,  _ToggleLED1,   PBP,  yes
    endm
    INT_CREATE               ; Creates the interrupt processor
ENDASM

T1CON = $31                ; Prescaler = 8, TMR1ON
@ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts

Main:
  PAUSE 1
GOTO Main

'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
     TOGGLE LED1
@ INT_RETURN
Code Size = 240 words
OK, Why?   You might ask.
Well, for one, this Blinky Light program will continue Blinking at the same rate, no matter what else you add to the Main: program loop.   Try doing that with pauses.

 


Previous: Hello Word            

Next: Elapsed Timer