Hi,
So I'm playing with DT's instant interrupts and even started to modify the T1CON register to adjust the prescaler. I'm using the 16F628A running at 4Mhz so it looks like the maximum time I can get from timer1 is about 0.5s
4Mhz/4 = 1us * 65535 = 0.0655ms * 8 (max prescaler) = 0.524s and that seems to work as my led blinks around 0.5s ON, 0.5s OFF
I'm very new to the interrupts and would like to trigger my interrupt if my switch on PortB.0 hasn't been pressed for at least 10 seconds.
How can I do that?
Thanks,
Tom
Code:
@ __config _HS_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
SWITCH VAR PORTB.0
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 = %00110001 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
Bookmarks