Hi. I'm still pulling my hair out trying to combine two or more instant interrupts
. The following code is from Darrel' example
Code:
LED1 VAR PORTD.0
LED2 VAR PORTD.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 INT_INT, _ToggleLED1, PBP, yes
INT_Handler TMR0_INT, _ToggleLED2, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE TMR0_INT ; enable Timer 0 interrupts
INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
ENDASM
OPTION_REG = OPTION_REG & $80 | 1 ' Set TMR0 Prescaler to 256, leave RBPU alone
Main:
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
'---[TMR0 - interrupt handler]-------------------------------(Blinky Light)------
T0Count VAR WORD
ToggleLED2:
T0Count = T0Count + 1
IF T0Count = 512 THEN T0Count = 0 : TOGGLE LED2
@ INT_RETURN
I eliminated the Elapsed_INT.bas interrupt from his example. I'm using a 16F193x chip, so I know I can't have high priority interrupts. Only with 18F chips you can have those. So, my next questions are very simple, I hope.
1) When either one of the interrupt handlers is servicing it's interrupt, what happens to the other counter? Does it stop until the other interrupt handler is over, or does it keep counting?
2) And, what happens if an interrupt counter overflows while the other interrupt handler is been serviced? Does that counter goes back to zero and starts counting again, or it just waits until the other handler is over?
I hope I explained myself clear and that somebody can enlighten me here
.
Thank you,
Robert
Bookmarks