|
|
View previous topic :: View next topic |
Author |
Message |
. Guest
|
Problem with strings |
Posted: Thu Jul 07, 2005 3:53 am |
|
|
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
|
|
Posted: Thu Jul 07, 2005 7:01 am |
|
|
Can't you break it up into two smaller strings then? Just preserve the screen position of the previous character. |
|
|
Ttelmah Guest
|
|
Posted: Thu Jul 07, 2005 8:04 am |
|
|
'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
|
|
Posted: Thu Jul 07, 2005 8:05 am |
|
|
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. |
|
|
|
|
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
|