HI!! 8051 microcontroller dont support float data type. How can I implement a float function???
Thanks
8051 microcontroller dont support float data type. no microcontroller does
How can I implement a float function??? the compiler does, but not for free. float is not included in the eval.
you should not need float to evaluate the tool, but maybe (while I doubt it) you need it for a project which the terms of use for the eval forbid you to use it for.
Erik
Thanks Erik,
I need float data because im implementing a PID (controller) and with int data the result is not expected.
i need greater precision!!
i need greater precision!! float gives you less precision than fixed
And you still need to buy the full version to use floats.
im implementing a PID (controller) sounds commercial and the licence for the eval clearly states "not to be used for commercial development". Anyhow, float or no float, I doubt you can fit a PID controller into 2k
I have the full version!!!!
then you can (although I recommend against it) use float to your hearts delight.
If you have the full Version, then what error message do you get when you try to use floats?
Maybe your expectation is wrong?
I have no error because im not implemented this float function. The 8051 manual say that this micro canÂ't do float operation. My question is if there is any way to do it??
I have no error because im not implemented this float function.
So you haven't even tried using a float datatype because you "know" that it will not work ?
Did you read the description of the C51 compiler ?
http://www.keil.com/c51/c51.asp
8051 manual say that this micro canÂ't do float operation.<p>
What the microcontroller can or cannot do it entirely irrelevant when you are using a compiler. The compiler is free to use appropriate libraries to do all the things that the underlying processor cannot do in hardware. It might, however, take a lot of CPU cycles to do all of that in software.
The 8051 also "cannot" do 16- and 32-bit integer arithmetics, and yet the compiler can offer int and long datatypes.
My question is if there is any way to do it??
Yes. You can use the compiler's floating point libraries (simply use float datatypes, the compiler will know what to do), or you can roll your own floating-point libraries in assembly. It's not rocket science, but about as useful as reinventing the wheel.
And as always, floating point math does not give you a higher resolution than integer math with the same number of bits (32 bits can only hold 2^32 different values - no data type can change anything about that). It gives you a larger range at the cost of adapting the resolution to the absolute value of the variable, with all the strange effects this will cause.
OK, Thanks Christoph