|
|
View previous topic :: View next topic |
Author |
Message |
julien lochen
Joined: 16 May 2008 Posts: 14
|
change the pointer from 8 bits to 16 bits |
Posted: Wed Jun 25, 2008 2:16 am |
|
|
Hello,
I use MPLAB IDE V8 with a PIC16F886
I need to declare the following table with 1536 elements:
const char tab_font_8x16[1536] = {0x0 ... }, so I need 16-bit pointers.
I added these lines at the top of the header file:
////////////////////////////////////
#device PIC16F886 *=16
#device ANSI
...
const char tab_font_8x16[1536] = {0x0 ... }, so I need 16-bit pointers.
////////////////////////////////
=> it says
"*** Error 74 "PIC_16F886.c" Line 372(0,1): Not enough RAM for all variables"
thanks, julien |
|
|
sv_shady
Joined: 07 Mar 2008 Posts: 28
|
|
Posted: Wed Jun 25, 2008 2:29 am |
|
|
The error has nothing to with the pointer. You cant declare such a huge array. This is more than 1MB... Look up into the datasheet how much RAM the MCU has and you must get in this limit. |
|
|
Ttelmah Guest
|
|
Posted: Wed Jun 25, 2008 2:53 am |
|
|
The array is 'only' 1536 elements, but because he has selected 'ANSI', 'const' values are stored in RAM. The chip has under 400 bytes of RAM, hence there is 'not enough RAM'.
If you switch to using CCS mode, rather than ANSI, the array will be stored in ROM, and will fit.
PS. It is considered 'bad form', to launch a new thread, asking the same question...
If you want to add something to your existing question, add it to the existing thread.
Best Wishes |
|
|
julien lochen
Joined: 16 May 2008 Posts: 14
|
|
Posted: Wed Jun 25, 2008 5:37 am |
|
|
ok, thanks, I removed "const", but it still doesn't work
#device PIC16F886 *=16
#device CCS4
char tab_font_8x16[1536] = {
0x0, 0x0, 0x0, 0x0,
... }
=> it says
Executing: "C:\Program files\Picc\CCSC.exe" +FM "PIC_16F886.c" +DF +LN +T +A +M -Z +ICD +Y=9 +EA
*** Error 74 "PIC_16F886.c" Line 290(0,1): Not enough RAM for all variables
1 Errors, 0 Warnings. |
|
|
Ttelmah Guest
|
|
Posted: Wed Jun 25, 2008 6:44 am |
|
|
Of course it won't.
Normal arrays are always stored in RAM. Again you cannot fit a 1536 element array into the RAM of the chip.
If you switch the compiler to CCS mode, instead of ANSI, you can then store the 'const' array in ROM.
Normal array uninitialised - stored in RAM
Normal array initialised - held in ROM at boot, and copied to RAM
Const array ANSI - like the initialised normal array, but does not support writes. Again copied to RAM.
Const array CCS3 - held in ROM
Get rid of the ANSI keyword, and keep the const declaration, and it should work.
Any array type that mentions 'RAM', _cannot_ work for the array involved.
There is little gained from using ANSI. You can set the arithmetic to default to signed yourself, and turn on case sensitivity, and it'll run just about the same, _except_ for how const is handled...
Best Wishes |
|
|
|
|
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
|