Menu

Nested sub depth in GCBasic internals

Help
joe rocci
2009-07-30
2013-05-30
  • joe rocci

    joe rocci - 2009-07-30

    Is there any documentation about how many levels of subroutine nesting the various built-in GCBasic functions contain? This would be very helpful to avoid over-pushing the PIC's small stack in the user code, especially in 16F parts.

    Joe

     
    • Nobody/Anonymous

      no documentation, but...
      seems that every sub or functin caal ude stack cell.
      depending on code an chip type it is possible to call from 2 to  nested calls.
      for more infrmation see chip datasheet. :)

       
    • J Olson

      J Olson - 2009-07-30

      You can nest as many calls as you have stack space, so if you got 8 then you can call 8 times before you get a stackoverflow. As mention this is located in your PIC datasheet(s). Its the same as if you were doing it in asm.

       
      • Nobody/Anonymous

        Thanks, but once again, that wasn't my queastion. i want to know how deep each of the built-in functions uses so I can figure out how many additional pushes my app can use, assuming I already know the stack depth for the part I'm using.

        Joe

         
    • J Olson

      J Olson - 2009-07-30

      Sorry I must have misunderstood your question originally.
      Just trying to help out where I can.

      I think what your after will need to come from Hugh or Kent. My assumption is the built in calls return off the top of the stack so we have available the entire stack after a built in calls return, but I do not know that for sure. It is correct there is no documentation on that currently.

       
      • Hugh Considine

        Hugh Considine - 2009-07-31

        It varies from one lot of internal routines to another, and even from one subroutine to another. Generally, 2 stack levels, but some routines (LCD and serial) will use 3, even 4 in the case of SerPrint.

         
        • joe rocci

          joe rocci - 2009-07-31

          Thanks Hugh...that's the kind of information I'm looking for.

          I'm working on the assumption that, if my program already is into a set of nested subroutines  of my own creation and I call a GCBasic built-in function, I risk over-pushing the stack and crashing the PIC.  I would have liked to have a list of how much further each individual GCB function pushes the stack. If I come p with that list, I'll post it.

          Joe

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.