Yeah Thanks Steve. It seems that doing this on the tiny AVR can really use up some cycles.
-----Original Message----- From: avr-gcc-list-bounces+res1zgde=verizon....@nongnu.org [mailto:avr-gcc-list-bounces+res1zgde=verizon....@nongnu.org]on Behalf Of Steven Michalske Sent: Wednesday, March 04, 2009 12:25 PM To: avr-gcc List Subject: Re: [avr-gcc-list] Floating Point operations on tiny25 probably something like this.... #define REF_VOLTAGE 2.56 float voltage = 0.0; voltage = ADC_VALUE * ( refVoltage / 2 ^ 10 ); double check that the compiler compiled the part in parentheses to a constant. As others have said, you will want to do fixed point math or other unit scaling once you fill your code space, as adding code floating point is expensive in code space. typical solution.... at a 2.56 volt reference you have 2.5 mV per bit. so do the math using integers, with this fact known. Have fun On Mar 4, 2009, at 6:18 PM, Rodney McCray wrote: > Does anyone have any working sample code that shows how to convert > 10 bit > ADC outputs into floating points using GCC. > I need to work with floating points on an ATtiny25. > > Best Regards, > Rodney > > > > > _______________________________________________ > AVR-GCC-list mailing list > AVR-GCC-list@nongnu.org > http://lists.nongnu.org/mailman/listinfo/avr-gcc-list _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list