Floating point is a limitation of the PBP compiler. Nothing to do with PICs in general. You can use a floating point library and get by, but the question is do you really really need it? Most times, you will be using compile time fractions which can be broken down into simple integer operations.
The most general work around is to find an equivalent fraction that can be represented in integer math. For example, if you need to do pi x d, you can do
(d * 22)/7 to get a value in integers
or
(d*220)/7 to get a value with 1 decimal place. Only now, you need to place the decimal point while displaying the value.
I use an utility called MISCEL from http://www.miscel.dk which allows you to compute integer equivalents of a fraction in various word sizes.
The liabilities of Floating Point
1 - Bulky code
2 - Very time intensive computing A single operation can take approx 2-300mS
3 - PBP does not support it
Of course, even the long support needs you to migrate your code to an 18F series![]()




Bookmarks