[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] efficient Timer Interrupts

From: Torsten Hahn
Subject: [avr-gcc-list] efficient Timer Interrupts
Date: Wed, 22 Oct 2003 16:57:57 +0200


i have an application where i want do stuff in an timer interrupt, but i want do the stuff only n times. So a solution would be the following:

volatile uint16_t cnt = 10000;

        // do stuff, e.g.
        // read data from an extern adc
        // accumulate data ...

        if(cnt--) {
                // stop the timer0 / interrupt and set an "ready" flag

The problem for me is, that using an extern (ram) var as a counter consumes much processor cycles (loading the var from ram, decrementing, write back). Is there a better (faster) solution ? Iam looking for a way to stop for example the timer 0 exactly after a given number of executions.

Any Ideas ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]