CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

memory

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
angel



Joined: 19 Oct 2004
Posts: 40

View user's profile Send private message

memory
PostPosted: Wed Aug 20, 2008 5:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 20, 2008 2:12 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 20, 2008 3:15 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 21, 2008 2:10 am     Reply with quote

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?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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