Go Down

Topic: printf() Command on Graphic LCD? (Read 2 times) previous topic - next topic

bperrybap

One other note about the use of printf
While it all works, you have to be careful with using up too much RAM space.
The issue is that when declaring a string like a printf formatting string,
the data for that string is stored in the data section.
All data section members end up not only in FLASH but also in RAM.
So each printf formatting string will consume RAM.

There are some interesting work arounds for transparently moving the
strings off to flash, but they are not very compatible with C++

As I update the library, I'll probably add in some "magic" to make it easier
to avoid the unneeded use of RAM.

But for now, in the glcd v3 beta just be aware that if you use the
Printf function, each formatting string will consume RAM.
If that is an issue, you can use Printf_P instead, but then you have to declare your string
as a string that lands in flash. While doable, it is a bit clumsy.

--- bill

kpob53

Wow, I was not expecting so much help and support from everybody out there! Just wanted to give a big thanks to everyone for the helf as I began my first Arduino project. 

I have succesfully hooked up a graphical LCD and #included the ks0108 library. I have also figured out how to print text and clear the screen and use several of the functoins in the library which has been a big help.

As far as space goes, a simple program is already using 7k of the total 32k availiable, so space is definately going to be an issue.  I suppose I should start a new thread for this, but I wil need to figure out how to do data logging on non volitile storage such as an SD card..

Thanks again for al of the help, much appreciated!

Go Up