PDA

View Full Version : DT Instant interups - interupt while executing an interupt routine question



comwarrior
- 15th December 2009, 20:15
High everyone.

I'm writing a monitoring and feedback program, a watchdog of sorts.
it's going to be running on an 18f4550 @ 48MHz.
the main routine is an LCD update and proberbly a bit of maths...
However, i'll be using RX_INT along with 4 timer interupts running at diferent speeds...

The question is, what happens if a timer interupt goes off while it's in the middle of another interupt routine say recieving usart data?

I'm hoping it will just run the int routine for the new interupt after it finishes the curent one...

Thanks

Darrel Taylor
- 15th December 2009, 23:50
You got it!
That's what will happen.
And the order they are executed will depend on the order in the INT_LIST.

For instance ...
With the INT_LIST below ..., INT_INT will be the first handler executed, if it's flag is set.
Then it will do TMR0_INT next (if flagged).
If another INT_INT happens while it's in TMR0_INT, then it will wait until TRM1_INT has also finished before it goes back around and handles INT_INT again.

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _ToggleLED1, PBP, yes
INT_Handler TMR0_INT, _ToggleLED2, PBP, yes
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM


If the INT_INT really can't wait for TMR1_INT then you can add another INT_INT handler in-between so that it won't have to wait.

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _ToggleLED1, PBP, yes
INT_Handler TMR0_INT, _ToggleLED2, PBP, yes
INT_Handler INT_INT, _ToggleLED1, PBP, yes
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

It still calls the same handler for both of them.

hth,

comwarrior
- 16th December 2009, 00:13
LOVELY!

I was worried about 'colliding' interupts for TMR1,2 and 3 when using a single 32.7K lp xtal... would make a mess if it started executed interupt routines in the middle of an interupt routine... lol

Thats DT and excelent work with inst ints...

are you planning to do more on your website?

Thanks

Darrel Taylor
- 16th December 2009, 03:22
Always glad I can help...

are you planning to do more on your website?
Got lots of plans ... just not a whole lot of "doing" going on there. :o
<br>

comwarrior
- 17th December 2009, 00:29
Darrel,
If their is anything i can do to help then give me a shout...