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

Problem with strings

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







Problem with strings
PostPosted: Thu Jul 07, 2005 3:53 am     Reply with quote

Hello,

I'm working on a program for a microcontroller to drive a 4*20 character display.
When the string that should be displayed is longer than 74 signs, an error appears "Error 6: String too long"
The display can display 80 signs and I want to use all of them!
How can I solve this problem?
valemike
Guest







PostPosted: Thu Jul 07, 2005 7:01 am     Reply with quote

Can't you break it up into two smaller strings then? Just preserve the screen position of the previous character.
Ttelmah
Guest







PostPosted: Thu Jul 07, 2005 8:04 am     Reply with quote

'A microcontroller', is a lot to go on...
In the case of the PIC's, the maximum size of string that can be used will vary with the RAM size, and more importantly the maximum RAM bank size. In the case (for example), of the 16F76, though it has 368 bytes of memory, the largest single 'block', is 112 bytes, and for most applications, the maximum that can be used in one lump, is 96 bytes (the top 16 bytes are shared with other banks). I'd suspect you are hitting a limit of the chip you have chosen. If you want to know for sure, post details of the chip involved.
That having been said, you don't need to have a string the 'size' of the display, to access every character available.

Best Wishes
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Jul 07, 2005 8:05 am     Reply with quote

Yes break up the strings.
The position is just the last place you added characters.
You don't get a new position unless you use a "goto_location" LCD command.

So send 2 smaller strings instead of a large one.



As for the reson why, If the compiler is complaining about the string size it is because the string is like an array, and has to be held in consecutive memory locations. And I am betting your string is hitting a memory bank boundry.
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