>>Without resorting to messy solutions such as software stacks, you will have >>to rewrite the code to minimise nested function calls. It may be possible >>to convert a small function to a macro so the code will be "inlined". This >>will reduce stack useage at the expense of code size. > I have a problem that my program produce code that use the stack 9 levels > deep. The pic16f877 has a 8 level stack. Help C Fundies? With the CCS compiler, you can inline functions with the "#inline" directive, which will save stack space at the expense of program memory (the converse is also available - the "#separate" directive). If you enable the "generate call tree" option (node properties), the compiler will create a .tre file in the project directory that you can look at to determine where the #inline directive could best be utilized. Note that this file is only current after a successful compile. Proper use of these directives *might* let you solve the problem without re- writing code. This is discussed a bit in the CCS manual in the "common questions and answers" section (albeit for a different problem), in the answer to "Why do I get an OUT OF ROM error when there seems to be ROM left?" -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body