I've been experimenting, if one could call it that, with Darryl Taylor's Interrupts and have another question.
How could I use the Blinky Led example to execute the toggleled but time itself out after a few seconds?
'************************************************* ****
Example from Darryl's website:
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
'************************************************* ****
I thought at first writing a
main:
@ sleep
@ nop
goto main
ToggleLED1:
TOGGLE LED1
REPEAT
i = i +1
UNTIL i > 10
If i >= 10 then
T1CON = $0
@ INT_RETURN
Well that through a wrench in my work, because for one it through off the led timing, makes it Slowwww... and second it just repeats itself because later I tried to add a:
main:
High LED1
pause 250
LOW LED1
@ sleep
@ nop
goto main
and I see the toggling of the led with the pause I added.
Anyhow, I am still tinkering and haven't burn anything up yet. Thanks for any suggestions
Bookmarks