Hi,
I am writing my first macros and I was wondering what the limits are regarding macros calling other macros.
In my case everything is completely linear.
My main flowchart calls MACRO 1.
MACRO 1 will call one of 4 other "MACROS XX" based on a parameter tested by MACRO 1.
MACROS XX will call one of two possible MACROS YY.
Then MACROS YY will complete, return to MACRO XX which will complete, and then return to MACRO 1 which will complete and return to the main flowchart.
This is a pure tree structure, there are no "stars" at any point.
Am I to deep with macros calling other macros?
What are the limits?
Thanks
Ron
Macros - How Many levels deep can your go?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello Ron
The absolute maximum subroutine levels in a PICmicro is 8. However it is always good practise to leave at least two of these levels free incase an interrupt or something similar occurs. If a interrupt did occur that went over the 8 levels of return adress stack then the PICmicro would become lost and may start to execute code in a random manner.
The absolute maximum subroutine levels in a PICmicro is 8. However it is always good practise to leave at least two of these levels free incase an interrupt or something similar occurs. If a interrupt did occur that went over the 8 levels of return adress stack then the PICmicro would become lost and may start to execute code in a random manner.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Although there are only 8 levels of stack in the PICmicro's hardware, the underlying C compiler is a bit more clever and can be set to use a software stack. So in theory, you should be able to use a lot more macro calls than 8.
Look at the "BoostC.pdf" help file - search for "stack" or "-swcs" for more information.
Look at the "BoostC.pdf" help file - search for "stack" or "-swcs" for more information.