PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 12, 2011 4:11 pm |
|
|
In his main() code, he has this:
Quote: |
void main()
{
NOKIA_INIT();
NOKIA_GOTOXY(1,1);
printf(nokia_printchar,"M.Yasser");
NOKIA_GOTOXY(20,10);
PRINTF(NOKIA_PRINTCHAR,"A Test!!");
printF(nokia_printchar,"NOKIA 3310 LCD");
while(1);
}
|
He's displaying constant strings. So I guess your question is how to use
printf to displays a string array, or how to display numbers.
Download the CCS manual and put it on your desktop.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look in the section on printf. It shows the template of how to do it:
Quote: |
printf (fname, cstring, values...)
|
fname = nokia_printchar
cstring = the format string used to display the desired type of variable.
values = the variables that you want to display.
Here is an example of how to display an 8-bit unsigned variable in
decimal format:
Code: |
void main()
{
int8 temp;
nokia_init();
nokia_gotoxy(1,1);
temp = 25;
printf(nokia_printchar, "%u", temp);
while(1);
}
|
To display other variables of a size larger than 8-bit, or a different type
than an integer, etc., then read the CCS manual and look at the format
strings in the printf section, such as %lu, %x, %lx, %f, %7.3f, etc. |
|