Hello Sir, i have a small question to ask. I have a LCD display interfaced to a 8051 micro controller.
If i have x for which the values ranges from 10 to 1 and i want to display it on the LCD screen with a string, how can i write the command? for example the data that the LCD should show is
////////////////////// Availability 10 Availability 9 Availability 8 . . . Availability 1 //////////////////////
where the number is x which ranges from 10 to 1 and the "Availabilty" is the string it should show each time the process self repeats.
its something like
lcd_command("Availability [x]") for(x=10,x>1,x-)
is this correct?
Thank you
Thank you for replying.
Is there any other method besides using sprintf? because i cant include the studio.h header file to my work space. i keep getting an error. the only header file that i am able to include is the reg51.h
One could use some basic string/character manipulation to compose the string yourself.
itoa() ?
itoa() is the basics of writing string and characters, am i correct?
is the code below correct?
int x; sprintf(Availabilty"%d",x);
May I suggest that you get a book on C programming?
Then you would learn how to write a for loop and how to use printf/sprintf/...
Definitely need to work on your C studies
int x; char buffer[32]; for(x=10; x>=1; x--) { sprintf(buffer, "Availabilty %d", x); lcd_command(buffer); }