|
Re: printf problem
printf does not support printing of floating points :'(. sorry, it just doesn't work. (see the comment in printf_lib.c)
What SHOULD work is using %d and then explicitly casting the float to an int.
IE: printf("%d\n", (int)fFloat);
Unfortunately, for me, this ALWAYS prints 0, no matter how large fFloat is.
I'm still having trouble with how to convert floats to ints. I wrote a quick function in c that I'm going to test today, and I found assembly routines from 1997 (see product note AN575 on microchip's page) that I will try.
Around here the consensus seems to be that floating points are more trouble than they are worth on this processor. In most cases where you would use floating point on the robot it's possible to do the math in the integer domain by multiplying first then dividing down.
|