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

out-of-ram moving from 873 to 876

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







out-of-ram moving from 873 to 876
PostPosted: Tue Dec 31, 2002 4:02 pm     Reply with quote

I'm trying to move code from a 16F873 to a 16F876. It compiles fine for the 873, but I'm running out of room. When I try to compile for the 876, I get a not-enough-RAM-for-variables error. The largest declare is a 16-byte buffer, certainly nothing near the 96-byte page boundary. Same problem occurs when trying to compile it for the 877. Is there some issue with how the RAM is chopped up on the 876 and 877 parts? I haven't tried the *=16 on the device yet, I'd rather not use the extra ROM if I don't have to. I'd just like to understand what the problem is.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10361
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: out-of-ram moving from 873 to 876
PostPosted: Tue Dec 31, 2002 4:30 pm     Reply with quote

:=I'm trying to move code from a 16F873 to a 16F876. It compiles fine for the 873, but I'm running out of room. When I try to compile for the 876, I get a not-enough-RAM-for-variables error. The largest declare is a 16-byte buffer, certainly nothing near the 96-byte page boundary. Same problem occurs when trying to compile it for the 877. Is there some issue with how the RAM is chopped up on the 876 and 877 parts? I haven't tried the *=16 on the device yet, I'd rather not use the extra ROM if I don't have to. I'd just like to understand what the problem is.
-----------------------------------------------------
The 16F876 and 16F877 have 16 bytes of common ram at the
end of each bank. The compiler uses at least 8 bytes of
this ram for internal variables. So if you only have the
first two banks enabled (ie., you're not using *=16), then
you really only have 80 + 80 + 8 = 168 ram locations available
(approximately).

But with the 16F873, it doesn't have the common ram area.
The compiler will still use some of the ram for internal
variables, but it won't affect the other bank. So the
available ram would be 96 + 96 - 8 = 184 bytes (approximately).

So you will lose 16 bytes (184 - 168 = 16) when you move to
the 16F876 or 16F877. You either need to cut your ram usage
or enable the 16-bit ram pointers.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10365
Dave S
Guest







Re: out-of-ram moving from 873 to 876
PostPosted: Tue Dec 31, 2002 4:47 pm     Reply with quote

:=-----------------------------------------------------
:=The 16F876 and 16F877 have 16 bytes of common ram at the
:=end of each bank. The compiler uses at least 8 bytes of
:=this ram for internal variables. So if you only have the
:=first two banks enabled (ie., you're not using *=16), then
:=you really only have 80 + 80 + 8 = 168 ram locations available
:=(approximately).
:=
:=But with the 16F873, it doesn't have the common ram area.
:=The compiler will still use some of the ram for internal
:=variables, but it won't affect the other bank. So the
:=available ram would be 96 + 96 - 8 = 184 bytes (approximately).
:=
:=So you will lose 16 bytes (184 - 168 = 16) when you move to
:=the 16F876 or 16F877. You either need to cut your ram usage
:=or enable the 16-bit ram pointers.

Thanks for the speedy reply. I enabled the 16-bit pointers and it seems to work fine. I appreciate the explanation.
Have a Happy New Year!
___________________________
This message was ported from CCS's old forum
Original Post ID: 10369
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