View previous topic :: View next topic |
Author |
Message |
ECACE
Joined: 24 Jul 2006 Posts: 94
|
How to printf the \ character??? |
Posted: Mon Jan 18, 2010 1:31 pm |
|
|
I am running into a problem, which I would have thought would be easy, but so far I can not figure out.
What is the secret to printing a "\" on the LCD? Below is a code snippet where I have an array and print one char at a time. All of the characters work, except \. Checking the K&R book, if I recall it said to use \\, but this just shows a greek character. So what is the trick in CCS C to printing a \ ???
In the code below I have commented out the sequence I want to display and have it working just showing the count of 1 2 3 4 5 over and over, just to make sure that it worked. When I use the commented out code, it shows all the chars except \, which shows as something like a Greek character.
Thanks in advance for any help you can give.
Code: |
char SWOD[6]; //SWOD MAP
static unsigned int SWOD_POS = 0; //SWOD Position Counter
...
...
...
...
...
...
void main()
{
setup_periferals(); //Before we do anything, setup the periferals
Load_SWOD(); //Load the SWOD with its positions
lcd_init(); //Initialize the LCD
while(TRUE)
{
printf(lcd_putc,"\f%c",SWOD[SWOD_POS]);
delay_ms(500);
SWOD_POS++;
if (SWOD_POS>=5)
SWOD_POS=0;
}
}
...
...
...
Load_SWOD(void)
{
//strcpy(SWOD,"|/-\"); //Loads the SWOD with the positions
strcpy(SWOD,"12345"); //Loads the SWOD with the positions
}
|
_________________ A HW Engineer 'trying' to do SW !!! Run!!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 18, 2010 1:43 pm |
|
|
Look in the data sheet for your LCD controller, and see if that character
is available in the pre-programmed character font for the LCD. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Jan 18, 2010 2:12 pm |
|
|
The commonly used Hitachi "A00" ROM hasn't it. You must load it as a user character to the RAM character generator. |
|
|
ECACE
Joined: 24 Jul 2006 Posts: 94
|
|
Posted: Mon Jan 18, 2010 3:01 pm |
|
|
Thanks for the info. I will look it up and see if it does or not. _________________ A HW Engineer 'trying' to do SW !!! Run!!! |
|
|
|