2008-09-09 08:49 PM
Floating point and LCD
2011-05-17 03:44 AM
1. Cortex M3 does not have hardware support for floating point arithmetic.
2. However, It is possible to use float numbers and do all arithmetic operations but compiler do in software and it needs hundreds of instructions to do it. Comparing to arithmetic on integers when it needs only few instructions. 3.Standard printf can print floats but much simpler way is to multiply by eg. 10000 and cast to int. iTemp=(int)(fTem*10000.0); [ This message was edited by: jaroslaw.oska on 09-09-2008 13:31 ]2011-05-17 03:44 AM
Does STM32F10 controller support floating point arithmetic? Is is possible to display the floating point number in the LCD?
Thanks AR2011-05-17 03:44 AM
Quote:
but compiler do in software and it needs hundreds of instructions to do it. Comparing to arithmetic on integers when it needs only few instructions.
Very true! A little thought will usually remove the ''need'' (sic) for floating point; eg, instead of using a floating point number to represent a length of 1.23m, just represent it as 1230mm - and floating point is no longer required! To display it in metres is simply a matter of adjusting the position of the decimal point... For another example, see2011-05-17 03:44 AM
2011-05-17 03:44 AM
Quote:
#define _FIX_Type long long int
Why would you use a #define rather than a typedef for this?2011-05-17 03:44 AM
Quote:
Why would you use a #define rather than a typedef for this? You are right st7 your proposition is safer. thx, J.O.