|
|
View previous topic :: View next topic |
Author |
Message |
cibinvarghese
Joined: 19 Jun 2009 Posts: 1
|
regarding interrupt latency |
Posted: Fri Jun 19, 2009 12:49 am |
|
|
hi,
I got a problem while using interrupts. I am using 3 external interrupts and timer0 interrupt. I use the priority in this order
Code: | #priority EXT,EXT1,EXT2,RTCC |
EXT,EXT1,EXT2 never occur at the same time.
I am using PIC18F4620. Clock frequency 40MHz.
When I check the waveform in oscilloscope there is a constant 5 microseconds delay between actual interrupt(EXT) and starting interrupt routine(INT_EXT) when RTCC interrupt is disabled.
And if I enable the RTCC the latency switches between 2us to 8us. If it was a constant delay of 8us then I could assume it as a delay produced by CCS compiler but I don't understand why I'm getting a 2us delay.
Thank you _________________ regards
cibin |
|
|
Ttelmah Guest
|
|
Posted: Fri Jun 19, 2009 5:30 am |
|
|
Remember that interrupts can't override each other. If your code is already _in_ the RTCC interrupt handler, then this handler will carry on executing this handler, complete, restore the registers, return to the main code, and only then call the global interrupt handler, save the registers again, check which interrupt has triggered, and only then call the EXT handler.
On the PIC, there are only two interrupt vectors. All interrupts in the standard handler, are 'polled' to see which one has triggered. #priority determines the order of this polling, but the polling only occurs at the moment the main handler is called. Once a handler is extered, it always completes.
If you want 'EXT', to have hrdware priority, then you need to add the command:
#device HIGH_INTS=TRUE
and change the #INT_EXT defintion, to:
#INT_EXT HIGH
This will then switch this interrupt to the second 'high priority' hardware vector, and it'll be able to interrupt the RTCC handler.
For the ultimate speed, you could change the INT_EXT declaration to:
#INT_EXT FAST
However _you_ then need to save any registers used inside your interrupt code, and handle clearing the interrupt as well.
Best Wishes |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Fri Jun 19, 2009 1:41 pm |
|
|
what i learned from life:
NO interrupts - NO problem.
1 interrupt - maybe a problem
more than one interrupt - In my case,
unintended consequences seems to increase with the SQUARE of the
number of INTS enabled.
BTW: if highly stable/repeatable execution time determinism is a requirement for your code - INTS are not for you either.
thats just me - but i find am doing the least debug when INTS =0 or 1
when i get to be a better yet programmer - maybe that will improve |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|