Conserving eeprom space
Lloyds
Posts: 75
Hi,
I am running out of eeprom space on the p40 and am working on paring the usage down. I apologize for asking what I'm sure has been covered before, but I am looking for easy ways to free up some space.
It looks like any "quoted" messages, including "spaces," in DEBUG and LCDOUT take up lots of room. Fixing those helped a lot. Using the special control characters in DEBUG helped too.
Turning some of the "cut and paste" code into subroutines, helped.
It seems like any number 'comments do not affect eeprom space.
What about the length of variable names, or the length of pin assignment names?
What about using hex vs decimal vs binary numbers in the code?
Any other easy ways?
I'm not ready to dive into the program slot method yet.
Thanks for any suggestions,
Lloyd
I am running out of eeprom space on the p40 and am working on paring the usage down. I apologize for asking what I'm sure has been covered before, but I am looking for easy ways to free up some space.
It looks like any "quoted" messages, including "spaces," in DEBUG and LCDOUT take up lots of room. Fixing those helped a lot. Using the special control characters in DEBUG helped too.
Turning some of the "cut and paste" code into subroutines, helped.
It seems like any number 'comments do not affect eeprom space.
What about the length of variable names, or the length of pin assignment names?
What about using hex vs decimal vs binary numbers in the code?
Any other easy ways?
I'm not ready to dive into the program slot method yet.
Thanks for any suggestions,
Lloyd
Comments
Then I use subroutines for 2 different things...
One is to make the code more clear an understandable. I stick something which does a specific task in a subroutine and give it a name which clearly indicates what it does.
Or code which is used again and again, I create one subroutine to do that.
For code which is used many times, it will save space to stick it in a subroutine. However for code which is used only once, it takes a bit more space to stick it in a subroutine. So if the code is used only once, don't stick it in a subroutine, then that will save space.
It's really not that hard to dive into a new slot where an expanse of untapped eeprom awaits you. A good way to start is to move the text to its own slot. Then your main slot only needs a method to pull that text out.
Here are demo routines that do that. A main routine for slot 0, and an indexed array of messages in slot 1.
I managed to par things down and use the subroutines this time, and all is functioning well.
But I see that I'll have to use the more advanced techniques before I can flesh out the documentation with a non-abbreviated compliment of LCD menus and debug screens.
Thanks again,
Lloyd
if cnt <> 50 then skip50
...
skip50:
takes less space then this:
IF cnt = 50 THEN
...
ENDIF
???