View previous topic :: View next topic |
Author |
Message |
bigfish
Joined: 08 Jan 2011 Posts: 18
|
Pic 16f877 writing program |
Posted: Tue Feb 08, 2011 7:57 pm |
|
|
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: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Feb 08, 2011 8:16 pm |
|
|
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
|
|
Posted: Tue Feb 08, 2011 9:15 pm |
|
|
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
|
|
Posted: Wed Feb 09, 2011 12:58 am |
|
|
show us your code? _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|