Harold Hallikainen wrote 2014-01-08 16:09: > >> The return stack on the mid range PICs is limited to 8 levels. Whilst >> this >> is generally adequate it is difficult to keep track of the call depth. >> Is >> there any tool for examining a program for maximum call depth? >> -- >> __________________________________________ >> David C Brown >> > > > While being absolutely no help on the pic 16 and 18,... In the datasheet for PIC16F1938/39 (but probably true for any enhanced midrange PIC) it says : -------------------------------------------------------------- 3.5.1 ACCESSING THE STACK The stack is available through the TOSH, TOSL and STKPTR registers. STKPTR is the current value of the Stack Pointer. TOSH:TOSL register pair points to the TOP of the stack. Both registers are read/writable. TOS is split into TOSH and TOSL due to the 15-bit size of the PC. To access the stack, adjust the value of STKPTR, which will position TOSH:TOSL, then read/write to TOSH:TOSL. -------------------------------------------------------------- So, as far as I understand, *if* you can set STKPTR and read TOSH:TOSL using a debugger, you should be able to do the same on the enhanced midrange PICs. > on the 24 and 32, I > write a known pattern in the ram area between the heap pointer and the > stack pointer djring initialization. I run the code for a while, then loo= k > at this area on the debugger to see how much has been overwritten. > > Harold > > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .