avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Floating Point operations on tiny25


From: Sean D'Epagnier
Subject: Re: [avr-gcc-list] Floating Point operations on tiny25
Date: Thu, 5 Mar 2009 20:10:11 -0700

Hi,

I am currently using the attiny861 with 32bit fixed point.  I am using
printf with fixed-point support for printing, as well as a lot of math
operations.

I doubt you can do anything useful with floating point on something
smaller than 8kb, because the floating point routines use flash.

The actual fixed point support for addition, subtraction,
multiplication, and division is _much_ smaller and faster than for
floating point, and should fit on an attiny25 a lot better.

For patches see the link:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=547570#547570

Sean

On Fri, Mar 6, 2009 at 7:35 AM, Rodney McCray <address@hidden> wrote:
> Yeah Thanks Steve.
> It seems that doing this on the tiny AVR can really use up some cycles.
>
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden 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
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
>
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>




reply via email to

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