Help with display/print function for LCD

Thread Starter

chimera

Joined Oct 21, 2010
122
I was thinking of the reverse.

the sprintf is the correct way to do it, using either %d or%i or any of the other formatting definitions.

It's the same in BoostC and gcc, so it should be the same in CCS (Which is included with launchpad)
Yes. I am using CCS for launchpad :D I am interfacing an LCD with it so I wrote the .h file will a lot of hassel. But it works!!!

Also, %i does not work for me when using sprintf(buffer,"%i",x) but it works when i use %d.

i even made sure I use global variables for when using %i but no use.

While I am on the subject, what the advantage or using volatile static variables versus just normal variables such int or char or float?
 

AlexR

Joined Jan 16, 2008
732
The volatile keyword is used for variables that can change outside of the program control. It tells the compiler not to optimise out the variable (turn it into a constant) just because the program does not appear to change its value. It also tells the compiler that the variable value must be checked each time it is used, i.e. its value must not be cached.

If the static keyword is applied to global variable it limits the scope of that variable to the source file where it is defined.

If the static keyword is applied to a local variable it forces that variable to retain its value even after the function ends and the variable goes out of scope. This means that the next time the function is called the variable retains the value that it had from the last time the function was called.
 

thatoneguy

Joined Feb 19, 2009
6,359
I now finally understand the usage of the term static and volatile. Thanks!
Now, knowing this, along with a variable's scope, PLEASE do not write your code using all variables named x, even if it works fine because they are in and out of their scope.

Some code obfuscation programs will do that, and it is annoying when you need to piece it back together from a disgruntled employee.
 
Hi

I am currently working on MSP430

We need to display int and char on LCD

And unable to display int and char we usede buffer and also Sprintf Function.

Can you any one please provide the code as you have already worked on this?

This helps our project a lot to complete one phase.

Waiting for your Valuable response

Thank you
 
Top