We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm trying to use printf with the %f format specifier to display some floating point values but nothing gets printed. I can print integers values just fine using the %d format. Has anyone else had this problem? I'm using the latest Keil C compiler and libraries on a Triscend 8051. Thanks,
Miles
My test code looks something like this:
void test() {
float x = 1.56;
printf( "test = %f",(float)x); }
It will always print "test = "
I figured it out, although I still don't quite understand what happened. I had an older routine that I wrote named Printf, which did not have a %f parser in it. Somehow the linker was calling that routine, even though I was spelling "printf" in the code with a lower case 'p'. When I removed all the calls to "Printf", then I guess it had no choice except to call the library "printf" function.
Although 'C' is case sensitive, other tools are not necessarily so - in particular, the Linker.
Check the Linker documentation to see it it is (or has been configured to be) case-insensitive...
I'm sure you are right about it being a case issue. I don't see anything in the Linker (BL51) manual about it. The assembler documentation lists a "CASE" control so that might be the problem right there. Thanks for the reply.