macros inside macros
Moderator: Benj
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
macros inside macros
concern arises from general paranoia on topic title... what are the rules on the above of what i cannot put in a personally made macro, ...suppose i drop in a macro and name it "stuff", can i put in 57 eeprom macros inside of it? i've done this kind of thing with lcd macros with out issues to keep things nice and tidy, but i have over a thousand eeprom macros (icons) i have to deal with and i would perfer to keep them neatly organized in 4 personal write to macros and 4 personal retreive from macros, is this ok or can this cause corruption, figured i would ask before going through all the work and have to change it incase i had some weird glitch
- 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:
Re: macros inside macros
Hello Brandon,
The general limitation with 16F 8-bit PICs is that the stack is restricted to 8 jumps away from the main.
So if you imagine this.
main -> LCD Macro -> LCD Component Macro -> Low Level LCD code
This shows 3 jumps away from the main code. If you go too far away from main then the program will be unable to find it's way back to the main and can cause corruption or lockups.
Having a large number of component macro calls in a single macro should not cause any problems at all as long as you do not break the 8 jump rule.
AVRs, ARMs and 16-bit PICs do not suffer from this issue and I think the jump count for 18F PIC devices is larger then 8.
The general limitation with 16F 8-bit PICs is that the stack is restricted to 8 jumps away from the main.
So if you imagine this.
main -> LCD Macro -> LCD Component Macro -> Low Level LCD code
This shows 3 jumps away from the main code. If you go too far away from main then the program will be unable to find it's way back to the main and can cause corruption or lockups.
Having a large number of component macro calls in a single macro should not cause any problems at all as long as you do not break the 8 jump rule.
AVRs, ARMs and 16-bit PICs do not suffer from this issue and I think the jump count for 18F PIC devices is larger then 8.
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