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

Pic 16f877 writing program

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



Joined: 08 Jan 2011
Posts: 18

View user's profile Send private message

Pic 16f877 writing program
PostPosted: Tue Feb 08, 2011 7:57 pm     Reply with quote

Hi all,

I'm using pic16f877A. When I try to write my program in it gives error:
"Out of ROM, A segment or the program is too large MAIN"

I was able to write in it until today, in fact I added a new if condition in my program, now the code has 255 lines including comments. Did I really manage to fill up the pic ROM ? Or something else?

Thanks
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 08, 2011 8:16 pm     Reply with quote

As listed in the CCS C Manual, in the ERROR messages chapter, I quote....

Out of ROM, A segment or the program is too large

A function and all of the INLINE functions it calls must fit into one segment (a hardware code page). For example, on the PIC16 chip a code page is 512 instructions. If a program has only one function and that function is 600 instructions long, you will get this error even though the chip has plenty of ROM left. The function needs to be split into at least two smaller functions. Even after this is done, this error may occur since the new function may be only called once and the linker might automatically INLINE it. This is easily determined by reviewing the call tree. If this error is caused by too many functions being automatically INLINED by the linker, simply add a #SEPARATE before a function to force the function to be SEPARATE. Separate functions can be allocated on any page that has room. The best way to understand the cause of this error is to review the call tree.

..end of quote
bigfish



Joined: 08 Jan 2011
Posts: 18

View user's profile Send private message

PostPosted: Tue Feb 08, 2011 9:15 pm     Reply with quote

Hi & thanks temtronic, I just have a large main function,which operates with more than 10 if blocks. So, according to this quotation, would you suggest me to write separate functions for conditions? When I compile CCS shows that ROM usage is about %25. I just changed one variable from long to int, and the problem has fixed just for now (I can't add any lines or variables or it gives the same error). Since I have time problem for this project, I didn't try much to understand the problem deeply. But I must figure it out for future works.

Anyone had similar problems and fixed ?
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 12:58 am     Reply with quote

show us your code?
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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