> From: Robert E. Griffith [mailto:bob@JUNGA.COM] > Sent: Tuesday, July 30, 2002 10:16 AM > > I have read several places - CSS C documentation, and a book > on PICs, that > you should not allow the number of stacks use by a program > running on a > mid-range PIC (like the 16F877 I am using) to grow to more than 9, but > neither place says why. Whenever I have a bug that I have a hard time > tracking down, I beat my stack usage back down to 9, but so > far, that has > never been the cure - I eventually find some other source for > the problem. > Now I cannot fit all my features into the program unless I > allow the stacks > to climb to 11 (9 main + 2 intr). Am I asking for trouble by > allowing this? You may very well be asking for trouble. The mid-range PICs have an 8 address cyclic stack in hardware. Every call pushes a return address on the stack. Pushing the 9th call address on the stack overwrites the first address on the stack. If you never plan on returning from your first call, it's not a big deal. If you do plan on returning, you are asking for trouble. If you have the instruction space I recommend that you write some of your functions inline. If you don't have the instruction space, think about using a PIC18F452. -Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu