[fpc-pascal] AVR Busy Wait implementation

Marc Santhoff M.Santhoff at web.de
Fri Jan 15 12:46:55 CET 2016


On Fr, 2016-01-15 at 08:48 +0200, Christo Crause wrote:
> There is a lot of useful information in avr-gcc code, once you can see past
> the peculiarities of C.

I agrre, but normally I don't need such precision. If working in a
millisecond range it's really overkill to use less than 100 nanosecond
accuracy, me thinks.

Well, if writing hard realtime OS timing functions or precise measuring
algorithms, that would be good.

>  See the implementation of avr-gcc's delay here:
> cvs.savannah.gnu.org/viewvc/avr-libc/include/util/delay.h and delay_basic.h
> in the same folder.

Thanks for the link.

>  Basically they use op codes with fixed cpu cycles to
> construct the inside of the loop and use compile time constants to
> calculate the number of iterations required for a delay. The focus of the
> code is to get accurate delays down to a few cpu cycles.

I've written some program parts in ARM Assembler, but generally I like
to avoid using it because of portability.

-- 
Marc Santhoff <M.Santhoff at web.de>




More information about the fpc-pascal mailing list