avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] Optimization safe access to the timers


From: Enoch H. Wexler
Subject: [avr-libc-dev] Optimization safe access to the timers
Date: Thu, 21 Sep 2006 19:11:51 -0400
User-agent: Thunderbird 1.5.0.7 (X11/20060914)

Hello libc maintainers,


May I suggest adding to libc an optimization safe access method to the
timers, for example:


typedef volatile int16_t (*pTCNT);
#define TCNT(n) *(pTCNT)(&TCNT ## n) /* e.g., TCNT(3) */


Without this a 100 "tick" delay loop like this would run forever:


int16_t when, time;


when = TCNT3 + 99;

do {

    do_something();

    time = when - TCNT3;

}

while (time >= 0);


Thanks, Enoch.








reply via email to

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