So i'm using printf with my LCD.
My question is.. i just want to display a float our double on my LCD..
using the %f flag doesn't seem to work.. is there something about float numbers i should know?
The default printf library does not handle floats. You need to link to the libprintf_flt library (in Configuration options, under the Libraries tab). I believe that you also need to link in the libm library as well.
Also, keep in mind that in avr-gcc, doubles and floats are the same size.
The Board helps those that help themselves.
thanks for the help.. but thatdidn't work... so you're saying i should be able to use printf so long as i link those libs? because i just did.. and no go..
doesn't seem to work
As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.
No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.
"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]
Also are you building with (a) your own Makefile, (b) an Mfile generated Makefile or (c) from within Studio (which auto-generates it's own style of Makefile). Each has methods for making sure the right libs get linked to use printf(%f) and, in fact, (b) has the easiest solution
The AVR Studio configuration options dialog box doesn't offer a "friendly" way to change the version of the printf library right now.
Simply adding the floating-point version of the library to the project is insufficient.
The Mfile-generated makefile template has provisions for doing this with a couple of mouse clicks.
Under AVR Studio's project management it is possible to emulate the extra steps required using an additional Linker Option on the "Custom Options" tab of the Project Options dialogue box.
See this thread for step-by-step instructions, and
See this thread for a detailed explanation of why this is necessary.
So now there are two forums for discussing the gnu c compiler, and none for discussing the commercial compilers?
Imagecraft compiler user
Blame Atmel for that - they're the ones that decided to put a GCC plugin into Studio to ensure GCC issues get discussed here.
© 2018 Microchip Technology Inc.