displaying problems
Posted: Fri Apr 07, 2006 11:46 am
Hi Raquel and Jon,
Thanks for the suggestions. I was able to make the program count but I can not
display the numbers as desired. The program counts well displaying the
numbers
1 on row1 column1 then , 2 on row1 column2 , 3 on row1 column3, ... etc. The program
displays up to 3-digit numbers (e.g. 147) and maybe even more. I want to be able to display these numbers
on a specific location
for example display 1-digit numbers (1-9) on row1 column1 then for
2-digit numbers (10-99)
display on row1 column1 and column2 then for 3-digit numbers display on row1 column1 column2 and column3 and so forth.
Is this possible?
I tried doing this by sending the cursor home (row1 column1) after displaying a 1-digit number
but the program behaved weird since it would only count up to 9 and then
reset the
count back to zero to start all over again. I also tried the "destructive backspace"
technique expained in the LK204-25 manual as well as other techniques but none
seemed to work. Any suggestions?
This is the code:
void printNumber(int number)
{
char string[10];
sprintf( string, "%i", number );
printString(string);
}
void printString(char txt[])
{
char i;
for(i=0;i<strlen(txt);i++)
{
USART_Transmit(txt);
USART_Transmit_Send_Cursor_Home(); // sends cursor home
}
}
Thanks for the suggestions. I was able to make the program count but I can not
display the numbers as desired. The program counts well displaying the
numbers
1 on row1 column1 then , 2 on row1 column2 , 3 on row1 column3, ... etc. The program
displays up to 3-digit numbers (e.g. 147) and maybe even more. I want to be able to display these numbers
on a specific location
for example display 1-digit numbers (1-9) on row1 column1 then for
2-digit numbers (10-99)
display on row1 column1 and column2 then for 3-digit numbers display on row1 column1 column2 and column3 and so forth.
Is this possible?
I tried doing this by sending the cursor home (row1 column1) after displaying a 1-digit number
but the program behaved weird since it would only count up to 9 and then
reset the
count back to zero to start all over again. I also tried the "destructive backspace"
technique expained in the LK204-25 manual as well as other techniques but none
seemed to work. Any suggestions?
This is the code:
void printNumber(int number)
{
char string[10];
sprintf( string, "%i", number );
printString(string);
}
void printString(char txt[])
{
char i;
for(i=0;i<strlen(txt);i++)
{
USART_Transmit(txt);
USART_Transmit_Send_Cursor_Home(); // sends cursor home
}
}