Xien
Joined: 12 Dec 2007 Posts: 2
|
Problems using all the RAM on PIC18F87J11 |
Posted: Thu Dec 13, 2007 10:44 am |
|
|
On my PIC18F87J11 platform I can only use approximately half of the available ram. Any time I go over 50% for any reason, my application will stop running shortly after reset. Resize any of my buffers so that the RAM usage goes down, and all my problems go away. Am I missing something? PCH 4.062 |
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 13, 2007 2:38 pm |
|
|
Do an experiment. Compile two versions of the code. Make one
version that works. Then increase the size of one of the arrays by
one byte, and verify that the program now fails. Now compare the
symbol tables (in the .SYM files) for each version. Check if the
compiler is allocating the same RAM address for two different variables
when it should not being doing this. Check to see if the bad program
uses some illegal RAM addresses.
Note: The compiler will re-use the RAM for local variables in a function,
because once you return from that function, the local variables are
considered to be destroyed anyway. So, expect to see that in the .SYM
file. But I'm suggesting that you should look for other problems in the
.SYM file, such as the re-use of RAM addresses for variables that are
declared in both main() and an interrupt service routine.
Also look for coding errors, where you write past the end of an array.
Some people forget that a string requires an additional byte at the end,
for the 0x00 byte that terminates the string.
Also, if you have the full CCS IDE, which comes with the Device Editor,
I suggest that you check the device data screen for your PIC. Make sure
that the RAM addresses that have been entered into the Device Data
are correct, according the PIC's data sheet. |
|