MCU= Atmel Avr (Atmega, Attiny…)
Programming software= WinAvr avrgcc
I’ve downloaded avrfix to use fixed point math in my program.
The zip file contains files named - “avrfix.h” “libavrfix.a” “sizes.txt” (not sure if it is of any use)
Q:-
-How do I use these files for fixed point calculations?
-In which directory these files to be copied so that the IDE (Winavr avrgcc) can use these.
-Do I need to change anything in the make file.
note:-
I created libraries for my self ( pair of files *.c & *.h) for different purposes.
I saved these in the same dir of main.c
The library is described here: http://sourceforge.net/projects/avrfix/ … %20Thesis/
You might find some help in AVRFreaks
interesting. I hadn’t seen that fixed point library in the past. Good thing, if it works properly.
Fixed point math is usually MUCH faster and smaller code size on a small/humble microprocessor than floating point in software.
I didn’t see any documentation. A quick glance at the .h file showed
/* Only two datatypes are used from the ISO/IEC standard:
* short _Accum with s7.8 bit format
* _Accum with s15.16 bit format
* long _Accum with s7.24 bit format
*/
typedef signed short _sAccum;
typedef signed long _Accum;
typedef signed long _lAccum;
so there are three types: signed with 7 integer bits and 8 fractional bits in a 16 bit short.
The other two are 32 bit longs, one with 16 fractional bit and one with 24 bit fractional part.
The rest of the .h shows macros and calls to the library (.a) routines for math functions.
No source code for the library. Sigh.
Perhaps one can find documentation because of this statement in the .h file
* Fixed Point Library *
* according to *
* ISO/IEC DTR 18037
where this
http://www.open-std.org/jtc1/sc22/wg14/ … /n1005.pdf
seems to say that the AVR fixed point code in the above is a subset of that in the ISO standard document per the PDF file.
A hero would document this work!
The documentation and source code is in the thesis that I linked above.