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

Send A Number Of Characters To LCD

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



Joined: 19 Feb 2009
Posts: 3

View user's profile Send private message Send e-mail MSN Messenger

Send A Number Of Characters To LCD
PostPosted: Thu Feb 19, 2009 4:49 am     Reply with quote

Hello, I'm using a LCD with built in ASCI compatible driver.

My code as it stands send 1 character per line, I want to be able to type all the characters together on one line.

After the LCD setup the program enables the register select bit.

I then use...... DATA('H'); //this sends a h to the lcd
if i then send DATA('I'); //this sends I to lcd

By sending the register select back to low the lcd displays HI

I can't seem to get a string working correctly what i have tried is....
Code:

void writestring(const rom char *s)
{
     unsigned char c;
     while((c=*s++)!='\0')
      DATA(c);
}

The error i get is in the declaration of the string.
Code:
void writestring(const rom char *s);

the error it gives is expected a , or )


Thanks in advance
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 19, 2009 3:39 pm     Reply with quote

See this post for an example of how to declare 'const' strings, and then
pass a pointer to them, to another function:
http://www.ccsinfo.com/forum/viewtopic.php?t=34682&start=4
gazzanet



Joined: 19 Feb 2009
Posts: 3

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Feb 20, 2009 4:26 am     Reply with quote

Yes i found the same thing in the ccs manual in the end after a very long looking time.

Is this the explanation of the answer you gave ?......

A (non-standard) feature has been added to the compiler to help get around the problems created
by the fact that pointers cannot be created to constant strings. A function that has one CHAR
parameter will accept a constant string where it is called. The compiler will generate a loop that will
call the function once for each character in the string.

Also. many thanks for your reply Razz
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