cembeddedpicmikroc

What is Nested Calls Limitations in MikroC?


I want to know what is the Nested Calls Limitations. I am using MikroC for PIC programming.

It says following limitations,

mikroC PRO for PIC limits the number of non-recursive nested calls to:

  • 8 calls for PIC12 family,
  • 8 calls for PIC16 family,
  • 16 calls for PIC16 Enhanced family.
  • 31 calls for PIC18 family.

is It external functions call limitations or If else or loop call limitations? What Nested Calls? How to count in the code to identify whether it is excited or not?


Solution

  • Example for PIC16 without any interrupts:

    This code is fine:

    /* prototypes */
    void func1 (void);
    void func2 (void);
    void func3 (void);
    void func4 (void);
    void func5 (void);
    void func6 (void);
    void func7 (void);
    void func8 (void);
    
    void func1(void) {
        /* do something here */
    }
    void func2(void) {
        /* do something here */
    }
    void func3(void) {
        /* do something here */
    }
    void func4(void) {
        /* do something here */
    }
    void func5(void) {
        /* do something here */
    }
    void func6(void) {
        /* do something here */
    }
    void func7(void) {
        /* do something here */
    }
    void func8(void) {
        /* do something here */
    }
    
    int main {
        func1();
        func2();
        func3();
        func4();
        func5();
        func6();
        func7();
        func8();
    }
    

    This code is not fine:

    /* prototypes */
    void func1 (void);
    void func2 (void);
    void func3 (void);
    void func4 (void);
    void func5 (void);
    void func6 (void);
    void func7 (void);
    void func8 (void);
    
      void func1(void) {
        func2();
    }
    void func2(void) {
        func3();
    }
    void func3(void) {
        func4();
    }
    void func4(void) {
        func5();
    }
    void func5(void) {
        func6();
    }
    void func6(void) {
        func7();
    }
    void func7(void) {
        func8();             /* here the stack reached 8. this will cause a problem */
    }
    void func8(void) {
        /* do something here */
    }
    
    int main {
        func1();
    }