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 support@ccsinfo.com

16F877-Not Enough RAM for variables??

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



Joined: 17 Feb 2004
Posts: 16

View user's profile Send private message

16F877-Not Enough RAM for variables??
PostPosted: Fri Feb 27, 2004 7:51 am     Reply with quote

hi,all
I wrote a program to interface a keyboard and LCD. I created an array of charactes whose length is 128. After clicking "build all", it said that there is not enough RAM for variables. Did anyone meet this problem before?? Could you please give some thoughts?? thanks in advance.

I am using MPLAB6.40 and PCM to program PIC16F877
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Fri Feb 27, 2004 8:41 am     Reply with quote

If you can post your code, that would help. Also, what version of the CCS compiler are you using? You gave the MPLAB version but if you are writing your code in C and compliling with CCS then we need to know that one too...
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

Re: 16F877-Not Enough RAM for variables??
PostPosted: Fri Feb 27, 2004 8:49 am     Reply with quote

water_river wrote:
hi,all
I wrote a program to interface a keyboard and LCD. I created an array of charactes whose length is 128.


On the PIC16 series, an array cannot be larger than the largest bank size. On most PICs that is 80bytes, some PICs have a 96byte bank.
Guest








PostPosted: Fri Feb 27, 2004 11:12 am     Reply with quote

You can do array of 256 bytes max.

By default, the CCS will use an 8 bits pointer to access ram, so if you have more than 256 bytes of variables it will say that ram is full.

To be able to access full ram you need to add the instruction
#device *=16
in the header file.
Guest








PostPosted: Fri Feb 27, 2004 11:15 am     Reply with quote

I made an error on the previous answer.

Array can be 256 bytes max when they're constant. ( in rom)

On ram they cant be bigger than a the available space in a bank like Darren Rook said.
CT
Guest







Re: 16F877-Not Enough RAM for variables??
PostPosted: Fri Feb 27, 2004 7:13 pm     Reply with quote

It may be an obvious solution, but if you really need an array that size, a simple memory manager could be written for reading/writing the arrays.

For example, define two 64-byte arrays and have a function that, when handed the address, simply writes/returns the data.

The function would then, say, use the first array for 0-63 and the second for 64-127.
water_river



Joined: 17 Feb 2004
Posts: 16

View user's profile Send private message

PostPosted: Sat Feb 28, 2004 1:04 am     Reply with quote

Thank you very much for the solutions.
BTW, the PCM compiler I used is quite old. Right now I am not able to check out its version.
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