What are the nesting limits of function calls on 8-bit PIC devices?
For PIC18 and mid-range PIC devices, the function call depth is the same as the depth of the hardware return address stack. Check the datasheet for the device you are using. Baseline PIC devices have a very small hardware stack depth (2 calls) and to work around this, the compiler can employ a call mechanism based on lookup tables. This allows a much larger level of function nesting, with no theoretical limit. Use of the alternate call mechanism is automatic. The call graph produced by the compiler (shown in the assembly list file for compiler versions 9.70 and above, or the map file for earlier compilers) can be used as a guide to stack depth, but this shows only a static analysis and so may not reflect actual usage. See your compiler manual for more information on function calls, and the fastcall qualifier.