View previous topic :: View next topic |
Author |
Message |
angel
Joined: 19 Oct 2004 Posts: 40
|
memory |
Posted: Wed Aug 20, 2008 5:09 am |
|
|
hi
I am using a pic 16F876 and after writing around 500 lines of code using #device *=16 and #separate commands, I have a memory usage: ROM=92% RAM=13% - 92%.
I think I wont be able to program much more functions...does anyone know some rules to program using CCS to improve memory performance? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 20, 2008 2:12 pm |
|
|
If you are storing text data in ROM, with the #rom statement, you can
use the 'char' option to pack two 7-bit chars per 14-bit word in the 16F
series PICs. See the CCS manual.
Here's a thread from the old CCS forum, with tips on how to save
ROM space in the 16-series PICs. Read the two posts that I made.
Scroll down to the links at the bottom.
http://web.archive.org/web/20031121200414/www.pic-c.com/forum/old/messages/1771.html |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Aug 20, 2008 3:15 pm |
|
|
Are you using any floats? Do you really Really REALLY need them? Scaled ints are almost always smaller, faster & better. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
angel
Joined: 19 Oct 2004 Posts: 40
|
|
Posted: Thu Aug 21, 2008 2:10 am |
|
|
Hi
Thanks PCM.
I am checking my code.
Yes SherpaDoug I am using floats....
One of my functions tries to read GPS information. I program that using
.....................
char DATA [71];
char charL[11];
..........................
if (kbhit()) {
gets(DATA);
}
...................
and then, for example if I want to read the latitude
charL[0]=DATA[n];
charL[1]=DATA[n+1];
charL[2]=DATA[n+2];
charL[3]=DATA[n+3];
charL[4]='.';//
charL[5]=DATA[n+4];
charL[6]=DATA[n+5];
charL[7]=DATA[n+6];
charL[8]=DATA[n+7];
parcialfloat1=strtod(charL,&ptr);
So I am using in the same function 2 arrays: DATA and charL. This function takes around 10% of the memory... do you know how to read GPS data in a better way? |
|
|
|