stack levels in pic mcu four leve deep or eight level deep

Discussion in 'General Electronics Chat' started by aamirali, May 11, 2013.

  1. aamirali

    Thread Starter Member

    Feb 2, 2012
    What is meaning of above. Like pic16f877a has 8 level deep.<br />
    <br />
    But i called multiple functions from function within.<br />
    <br />
    Is it size in bytes or what??
    Last edited: Sep 20, 2013
  2. MrChips


    Oct 2, 2009
    It means that if you are using function calls from asm, you must make sure that you do not nest calls more that 8 levels. Pay particular attention when you also have interrupts.

    C compilers have to overcome this limitation using software methods.

    That's one of the reasons I am not a big fan of PICs.
  3. Dodgydave

    Distinguished Member

    Jun 22, 2012
    Think of it as "pass the parcel" in a line,

    if you have 8 people in a line and give the parcel to the first person (that's a call) then do it again the parcel goes to the next person, and so on every time you "call" when you get to the last person you have to "return" ,if you "call" again the parcel falls on the floor,

    "return" makes the parcel go back to the previous person, keep "returning" until you have the parcel.

    if you " call " more times than the limit your programme will crash!
    Last edited: May 12, 2013
    djsfantasi likes this.