View previous topic :: View next topic |
Author |
Message |
edbfmi Guest
|
Out of memory - Using 12-Bit part (16C57) |
Posted: Thu Jul 13, 2006 2:53 pm |
|
|
I see where this question has been answered a 1000 times for 14 bit parts using the #device *=16 command. My problem is I am using a PIC16C57 and it is a 12bit part. What can I do to let the compiler use the extra three pages of memory? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 13, 2006 3:05 pm |
|
|
That device statement affects RAM usage. Your question is about ROM.
Page sizes on the 16C57 are relatively small -- they're only 512 bytes.
Compare this to 2KB pages on the 16F877. In CCS, a function must
fit within a ROM page. It can't span 2 or more pages. So one possible
reason for "out of ROM" is that a function is too large. You need to
reduce the size. Split it up into two or more functions. Also, avoid
using floating point with such a small PIC. |
|
|
Ttelmah Guest
|
|
Posted: Thu Jul 13, 2006 3:20 pm |
|
|
#device *=8
Your chip, only supports 72 bytes of RAM, so only needs a 8 bit address, .
So:
Code: |
#include <16C57>
#device *=8
void main() {
int array[16];
int array2[16];
int array3[16];
int test,test1,test2;
//Rest of code here
}
|
Will fit array2, and array3, into the higher banks.
Rmember that you will be 'stuck' with the largest possible element in the higher banks, being 16 bytes.
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 13, 2006 4:12 pm |
|
|
Sorry. As soon as I saw the "three pages", I immediately jumped on
it as a ROM issue. |
|
|
Ttelmah Guest
|
|
Posted: Fri Jul 14, 2006 3:56 am |
|
|
Like me, - only 'human' (or near at least...)...
It is an oddity really, that the 12 parts default to using a 5bit RAM address, while the 16 parts default to a 8bit address. Relatively poorly documented.
Best Wishes |
|
|
|