|
|
View previous topic :: View next topic |
Author |
Message |
rudy
Joined: 27 Apr 2008 Posts: 168
|
1024 bytes variable size |
Posted: Sun Oct 25, 2015 2:10 pm |
|
|
Hi there.
I am working with 16F688, which have 4096K program memory. I finishing a program just to show a logo in LCD, the logo have 1024 bytes long. The rest of the program is tiny. Why I can´t put this array in the memory, the compiler shows an error, “Data item too big”.
Anything greater than 100 bytes is error!!!
Any help?
Code: | const int logo[1024]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0xBE, 0xB6, 0xF6, 0xE6, 0x00, 0x00, 0xFE, 0xFE, 0x80,
0x80, 0x80, 0xFE, 0xFE, 0x00, 0x00, 0xFE, 0xFE, 0x84, 0x86, 0x86, 0xFE, 0xFC, 0x00, 0x00, 0xFC,
0xFE, 0x96, 0x96, 0x96, 0x9E, 0xDC, 0x00, 0x00, 0xFE, 0xFE, 0x0C, 0x06, 0x06, 0x00, 0x9C, 0xBE,
0xB6, 0xF6, 0xE6, 0x00, 0x00, 0xFE, 0xFE, 0x80, 0x80, 0x80, 0xFE, 0xFE, 0x00, 0x00, 0xFE, 0xFE,
0x84, 0x86, 0x86, 0xFE, 0xFC, 0x00, 0x00, 0xFC, 0xFE, 0x96, 0x96, 0x96, 0x9E, 0xDC, 0x00, 0x00,
0xFE, 0xFE, 0x0C, 0x06, 0x06, 0x06, 0xFF, 0xFF, 0x06, 0x06, 0x00, 0xFE, 0xFE, 0x0C, 0x06, 0x06,
0x00, 0xEC, 0xF6, 0x96, 0x96, 0xFE, 0xFC, 0x00, 0x00, 0xFE, 0xFE, 0x0C, 0x06, 0x06, 0xFE, 0xFC,
0x00, 0x00, 0xC6, 0xE6, 0xB6, 0x9E, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0F, 0x0F,
0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x30, 0xB0, 0xD8, 0xD8, 0xD8, 0xD8, 0x18,
0x30, 0xF0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x80,
0xC0, 0xC0, 0xC0, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0,
0x80, 0x00, 0x00, 0xD8, 0xD8, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00,
0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x7F, 0x60, 0xCF, 0xDF, 0xD8, 0xCC, 0xDF, 0xDB, 0x18,
0x1C, 0x0F, 0x07, 0x00, 0x00, 0xDB, 0xFF, 0xB6, 0xB6, 0xB7, 0xF3, 0xE0, 0x00, 0x3F, 0x3F, 0x01,
0x00, 0x00, 0x3F, 0x3F, 0x01, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x1D, 0x3E, 0x32, 0x12, 0x3F,
0x3F, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00,
0x1F, 0x3F, 0x30, 0x30, 0x30, 0x19, 0x00, 0x1F, 0x3F, 0x30, 0x30, 0x30, 0x3F, 0x1F, 0x00, 0x00,
0x3F, 0x3F, 0x01, 0x00, 0x00, 0x3F, 0x3F, 0x01, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x00, 0xF0, 0xF0, 0x60, 0x30, 0x30, 0x00,
0xF6, 0xF6, 0x00, 0x00, 0xE0, 0xF0, 0xB0, 0xB0, 0xB0, 0xF0, 0xE0, 0x00, 0x00, 0xE0, 0xF0, 0xB0,
0xB0, 0x30, 0x00, 0x30, 0xFC, 0xFC, 0x30, 0x30, 0x00, 0x00, 0xE0, 0xF0, 0xB0, 0xB0, 0xB0, 0xF0,
0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xF6, 0x00, 0x30, 0xFC,
0xFC, 0x30, 0x30, 0x00, 0x00, 0x60, 0xB0, 0xB0, 0xB0, 0xF0, 0xE0, 0x00, 0x00, 0xFF, 0xFF, 0x00,
0x30, 0xF0, 0xC0, 0x00, 0x00, 0xC0, 0xF0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x0F, 0x00, 0x00, 0x07, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x0C, 0x0D, 0x0D,
0x0F, 0x07, 0x00, 0x00, 0x07, 0x0F, 0x0C, 0x0C, 0x00, 0x00, 0x07, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C,
0x06, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x07,
0x0F, 0x0C, 0x0C, 0x00, 0x00, 0x07, 0x0F, 0x0C, 0x04, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00,
0x00, 0x01, 0x67, 0x7E, 0x1E, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Sun Oct 25, 2015 2:28 pm |
|
|
First, you need to tell us your compiler version?.
Historically there was a limit for a const, as a single bank only, but this only applies to very old compilers (something like 5 years old...). This restricts the maximum size to 128 locations.
Your table will compile fine with any reasonably recent version of the compiler. Last hundred versions or so!... |
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Sun Oct 25, 2015 2:43 pm |
|
|
Hi,
I am not sure if this is what you ask, but I clicked in Help, about. it shows 4.065 for IDE, PCB, PCM, PCH and PCD.
Is this what you mean?
Regards. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 25, 2015 4:44 pm |
|
|
Results with CCS compiler vs. 5.050:
Quote: | Executing: "C:\Program files\Picc\CCSC.exe" +FM "PCM_Test.c" +DF +LY -T -A +M -Z +Y=9 +EA #__16F688=TRUE
Memory usage: ROM=26% RAM=4% - 4%
0 Errors, 0 Warnings.
Build Successful.
Loaded C:\Program Files\PICC\Projects\PCM_Test\PCM_Test.cof.
BUILD SUCCEEDED: Sun Oct 25 15:44:11 2015
|
Test program:
Code: | #include <16F688.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT
#use delay(clock=4M)
const int logo[1024]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Middle portion cut for brevity, but it's the same array
// as you posted above.
0x0F, 0x0C, 0x0C, 0x00, 0x00, 0x07, 0x0F, 0x0C, 0x04, 0x0F, 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00,
0x00, 0x01, 0x67, 0x7E, 0x1E, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
//==========================================
void main()
{
int16 i;
int8 value;
value = logo[i];
while(TRUE);
} |
|
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Sun Oct 25, 2015 5:48 pm |
|
|
I don't understand!
I am writing through MPLAB, will be this the problem?
Regards. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 25, 2015 6:08 pm |
|
|
Quote: | it shows 4.065 for IDE, PCB, PCM, PCH and PCD. |
You said you have compiler vs. 4.065. Your problem with the large array
is a bug in that old version. In compiler version 5.050, the problem is fixed.
Using MPLAB doesn't affect the array problem at all. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Mon Oct 26, 2015 2:15 am |
|
|
4.065, was late 2009.
V4, also only just about started to actually work at all reasonably at this point. It was close to a 'beta'. V4, ran to 4.141. V5, has 50 versions now. So it is 126 versions old, and about 6 years.....
Just tried a few V4 versions. By 4.104 (early 2010), it was working. So my guess of about 5 years was 'spot on'. |
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Mon Oct 26, 2015 6:29 am |
|
|
Thank you all!.
Really proved!!, the version was too old.
Never had this kind of problem, but I am sure that I had faced some others problems (totally unexpected and unexplained) due to this old version I was using.
Regards. |
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Tue Apr 19, 2016 7:27 pm |
|
|
Good day.
Continuing with this matter, Now I am writing a new approach, trying to use the same array to all my needs, and load some 24C04 values to the arra for future use.
I still don´t understand why this statement Works:
Code: | const int bt[768]={...}; |
and this one don´t
The same error appear, Data item too big!
I just cannot change anything in this array, why? If I am plenty of memory space.
Now I using a 5.007 version. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1355
|
|
Posted: Tue Apr 19, 2016 7:47 pm |
|
|
The 16F688 only has 256 bytes of RAM. You are trying to use 768 bytes of RAM in that second statement |
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Tue Apr 19, 2016 8:00 pm |
|
|
jeremiah, thanks.
Is there any solution for this ? By the way, now I am using 16f876A.
I need to change these array values when needed.
Regards. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Wed Apr 20, 2016 1:19 am |
|
|
If the values need to be in RAM, then the only real answer is a PIC with a lot more RAM. Generally PIC18's.
There may be a 'micro bodge' solution, depending on how many values actually have to change. For instance you could have the array in ROM, and then a small RAM table of 'changes'. However code size then gets larger....
Generally, this is why most of the 'old hands' here will always start with a much 'too large' PIC. On the final version, if production quantities merit saving cents, then we may well hone down to fit in a much smaller chip, but it is much easier to start with a chip 'overflowing' with peripherals, ROM & RAM, and then work out which parts are really needed, than to waste time trying to fit things in a chip that is too small.
A PIC like the 18F2520 for example, is the same physical size as your current chip, but gives you 32K ROM & 1536 bytes of RAM.
Also if you look at the 16F876A on the Microchip site, you will find the message 'not recommended for new designs'. Basically an obsolete chip that they may stop producing. It is also more expensive than the newer chips. So the 2520, is priced at $3.18, while the 876A is over a dollar more..... |
|
|
rudy
Joined: 27 Apr 2008 Posts: 168
|
|
Posted: Wed Apr 20, 2016 5:59 am |
|
|
Thanks Ttelmah.
I think this is the solution, besides, I have some 18F2520 here, and will move toward this direction.
Regards. |
|
|
|
|
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
|