How many levels deep can macros be called?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
addaeng
Posts: 6
Joined: Sun Aug 06, 2006 5:37 pm
Contact:

How many levels deep can macros be called?

Post by addaeng »

Another silly question.
Cant find this indo in the help.

How many times can I call a macro.

ie. call a macro from a macro from a macro..........................

Is this possible at all?

Thanks again

Brian

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Post by Ian »

No idea off hand.

I don't think there is a limit (Steve will be able to say for sure) but having way too many would get confusing and start to become unweildly. So for practical purposes there is a limit based on humna

I have had bunches of macros in macros in macros etc. without problem.
I don't think I've ever had a program fail because it has had too many macro layers in it.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

There is a limit because the 16F PICmicros have an internal stack limited to 8 addresses. This means that you can only have 8 nested macro calls (assuming interrupts are not used). This is plenty for the majority of apps.

Incidentally, the new v3 of FlowCode uses a different underlying compiler which actually gives an error message when the stack level is exceeded.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Also note that 18F PICmicros have a 31-level stack, which is much more generous. FlowCode v3 will work with 18F targets.

Post Reply