| View previous topic :: View next topic |
| Author |
Message |
Izzy
Joined: 27 May 2007 Posts: 106
|
|
Posted: Thu Jan 01, 2009 4:45 pm |
|
|
Thanks PCM programmer, it solved the mystery.lol
After I added 'if(c >= 0x20) ' it started to give '@' after every word. But adding another condition helped.
if(c >= 0x20 && c!=0x40) //0x40 = @
Do you have any thoughts on the my second question?
I dont know why the graphics are shifted when I changed the font from 8x8 to 6x8. By saying graphics I mean lines and bars.(Please note I am using text address for graphics) i.e. glcd_gotoxy(6,1,1);
I know it has something to do with this:
| Quote: | unsigned int16 TextHome = 0x0A00;//0x0780;
const int8 TextArea = 0x0028; // how many bytes before a new line // 0x28 = 40
const int16 GraphicsHome = 0x0000;
const int8 GraphicsArea = 0x0028; // how many bytes before a new line |
But I am not getting good results. |
|
 |
Izzy
Joined: 27 May 2007 Posts: 106
|
|
Posted: Thu Jan 01, 2009 5:43 pm |
|
|
Oh well, looks like that was not the solution, because it sometime prints random character like numbers and alphabets which I cannot include in the if condition. I am not sure what I can do now.
| PCM programmer wrote: | That's what I thought. You probably have this problem here:
https://www.ccsinfo.com/forum/viewtopic.php?t=24661&start=74
One possible work-around would be to change the glcd_putc() routine
so it only accepts printable characters. Example:
Changes are shown in bold below:
| Quote: | void glcd_putc(char c) {
if(c >= 0x20)
glcd_WriteCmd1(c - 0x20, 0xc0);
} |
Try that. See if it fixes the problem. |
|
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 01, 2009 6:05 pm |
|
|
I wasn't sure it would work. It's not a solution if it's printing a random character at the end.
Try another work-around. Copy the text to a temporary RAM array.
Then use the re-direction feature of printf to send it to lcd_putc().
| Code: | char temp[41];
strcpy(temp, "G-Force");
printf(lcd_putc, "%s", temp); |
Or just upgrade the compiler. I don't want to work on these bugs anymore. |
|
 |
Izzy
Joined: 27 May 2007 Posts: 106
|
|
Posted: Fri Jan 02, 2009 5:32 pm |
|
|
Any one know about this question?
| Izzy wrote: | Thanks PCM programmer, it solved the mystery.lol
Do you have any thoughts on the my second question?
I dont know why the graphics are shifted when I changed the font from 8x8 to 6x8. By saying graphics I mean lines and bars that was drawn using the Line and Square function.(Please note I am using text address for graphics) i.e. glcd_gotoxy(6,1,1);
I know it has something to do with this:
| Quote: | unsigned int16 TextHome = 0x0A00;
const int8 TextArea = 0x0028; // how many bytes before a new line // 0x28 = 40
const int16 GraphicsHome = 0x0000;
const int8 GraphicsArea = 0x0028; // how many bytes before a new line |
But I am not getting good results. |
|
|
 |
|