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: Rodney McCray
Subject: RE: [avr-gcc-list] Floating Point operations on tiny25
Date: Fri, 06 Mar 2009 06:35:20 -0800

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






reply via email to

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