Seasons Greetings to All,
I am stillllll busy with a pic project to control a potters kiln with all sorts of operator options and selections via keyboard and ADC ......only in software at this stage....
When I started the project and not knowing much about memory usage I randomly chose a 16f877A chip ......now I am becoming concerned about how much FLASH & RAM memory I have used / left. I have not, actually I have never used EEPROM memory and am keen to try it in the delay for Mark / Space control of the TRIAC so as not to "stop" the "real time clock", which is using the TMR0 function. I digress.........so to the point........
I need help in confirming what I have learned via the forums and learning center on memory.
1) It is better to use many MACROS instead of only Main ....is that for speed or memory location saving...there a limit to number of MACROS?
2) Use local variables where possible as opposed to global
3)Any restrictions on calling a MACRO from within a MACRO and only returning to Main occasionally?
+ Can anyone direct me to a site with a course / article on efficient memory usage... I am "virtually blind" to this important aspect of programming
+ How Can I check for available memory during "programming"
PS I have not upgraded from V4 to V6....yet
Looking forward to replies,
Manie
Memory usage query
-
Manie Serrao
- Flowcode V4 User
- Posts: 26
- Joined: Mon Nov 28, 2011 3:19 pm
- Location: Cape Town South Afica
- Has thanked: 10 times
- Been thanked: 2 times
- Contact:
- 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: Memory usage query
Hello Manie,
Available memory should be shown as part of the compiler output messages.
If you do run out of room then the 16F1937 or 16F1939 has more memory available but is 100% pin compatible.
There is no limit to the number of macros you can have in your program. Try to make each macro do a specific job or a chunk of code you want to re-use over and over again in your program.1) It is better to use many MACROS instead of only Main ....is that for speed or memory location saving...there a limit to number of MACROS?
Local variable will only consume memory while the stack is inside the macro that refers to them. Global variables will always consume memory.2) Use local variables where possible as opposed to global
8-bit PICs have a hardware stack of 8 jumps away from the main (including interrupts) the compiler message should warn you if you go over the limit. The compiler also has options for a software stack to provide more jumps away from the main if required at the cost of RAM usage.3)Any restrictions on calling a MACRO from within a MACRO and only returning to Main occasionally?
Available memory should be shown as part of the compiler output messages.
If you do run out of room then the 16F1937 or 16F1939 has more memory available but is 100% pin compatible.
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