[Icc-avr] Global Interrupts
John Baraclough
j_baraclough at zetnet.co.uk
Tue Jan 8 15:05:00 PST 2008
Andrew,
Firstly when you change the subject in a post please delete the
preceeding irrelevent stuff, so that we can identify your real question.
It depends on how long your ADC handling function takes. and how you
have set up the timer. A timer interrupt will remain pending until the
ISR is executed, and it is the ISR execution which will clear the
interrupt flag. Now, if the ADC handler takes longer than the interval
between timer interrupts then you will miss an interrupt and the timing
will be incorrect. Also, if you have set up the timer so that it
requires the ISR to reload the timer counter or change the compare
register, then you will have errors from the additional latency. To be
100% bomb-proof with timer interrupts they must be set up so the timer
reloads or resets in hardware to avoid latency issues and the interval
between timer interrupts should be considerably longer than the slowest
non-interruptible code in your main program flow.
John
Andrew wrote:
> Hi,
>
> i have an ADC connect to my system using SPI and in the back ground a
> tick timer overflow interrupt (100ms). when i call my read ADC
> function to avoid any interrupts messing things i was going to do the
> follwing: -
>
>
> CLI(); // Disable all interrupts
> Get 4 Channels of results
>
> SEI(); // Re-enable interrupts
>
>
>
> My question is will doing that screw the timer up or will it carry on
> from where it left off after i re-enable the interrupts.
>
>
>
> Andy
>
More information about the Icc-avr
mailing list