[Top][All Lists]

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

[avr-libc-dev] [patch #6236] Improving _delay_us and _delay_ms

From: Florin-Viorel Petrov
Subject: [avr-libc-dev] [patch #6236] Improving _delay_us and _delay_ms
Date: Wed, 17 Oct 2007 16:13:26 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv: Gecko/20070914 Firefox/


                 Summary: Improving _delay_us and _delay_ms
                 Project: AVR C Runtime Library
            Submitted by: fonitzu
            Submitted on: Wednesday 10/17/2007 at 16:13
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any



_delay_us and _delay_ms are improved with a fall-back functionality, that
means, instead of clipping to the maximal possible delay in case of exceeding
allowable argument value, they behave so:
_delay_us will call _delay_ms instead
_delay_ms will perform a delay up to 6.55 seconds using a 0.1ms delay loop

This will avoid subtle errors on the user side when one require delays longer
than allowed - for example _delay_us(1000) will be compiled as _delay_ms(1)

As proved on my computer, the compiler, using optimizations, will simply
replace _delay_us with _delay_ms if it's the case and _delay_ms will be
expanded to a small loop only if it's necessary.

Known problems: 
- the user will not be informed in a fall-back case
- for _delay_ms it will be always a trade-of between loop resolution (0.1ms
now) and induced error (loop counter overhead)


File Attachments:

Date: Wednesday 10/17/2007 at 16:13  Name: delay.h  Size: 6kB   By: fonitzu



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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