CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to printf the \ character???

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

How to printf the \ character???
PostPosted: Mon Jan 18, 2010 1:31 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 1:43 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 2:12 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 3:01 pm     Reply with quote

Thanks for the info. I will look it up and see if it does or not.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group