Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM full — Parallax Forums

EEPROM full

KellyHKellyH Posts: 4
edited 2009-04-03 21:46 in BASIC Stamp
I'm writing a relatively simple program, and was not concerned with saving space (poor form, I know, but I'm new at this, and it's more of a means than and end), assuming I would have plenty of room. I was surprised when I found that my EEPROM was full. As I understand it, the amount of EEPROM I use depends on the number of program commands I use. Is that right? Are there any general ways to reduce the EEPROM size of a program?
Thanks,
Kell

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-04-02 22:53
    I'm guessing that your program has lots of DEBUG statements, right? Those eat up memory quite quickly. You can save memory by using acronyms (instead of "First Number: " use "N1:", etc.) If you post your program (as an attachment) then some specific recommendations can be made.
  • KellyHKellyH Posts: 4
    edited 2009-04-03 04:27
    Thanks- I do use a couple (although I wouldn't say lots) of DEBUG statements. It was my understanding that any given command uses essentially the same amount of EEPROM. But that isn't the case? I don't leave in DEBUGS that were actually for debugging, but I do use DEBUG and DEBUGIN as a makeshift GUI, which may be a bad idea, turns out.
    I had no idea that the length of variable names should be a consideration, either (like I said, new at this).
    There was also a particular subroutine that I wrote, then modified, then realized that there was a better way to implement, but was under pressure to get a functional product working and so I didn't make the changes I wanted to right away. So, I'm going back to fix that, and will shorten variable names. If that doesn't free up enough space, I will post again (with code).
    Thank you!
    Kell
  • SRLMSRLM Posts: 5,045
    edited 2009-04-03 04:42
    Long variable names don't change the size of the program*, but the size will (Bit, Nib, Byte, Word).

    Debug statements take up lots of room because the string to output to the screen has to be stored in EEPROM. By shortening the length of what you output to the screen you can save memory.

    * Long variable names will increase your memory requirements if you use the '?' operator in a statement like "DEBUG DEC3 ? superLongVariableName"
  • Andy FoxAndy Fox Posts: 46
    edited 2009-04-03 15:43
    Without seeing the actual source it's a little hard to say. Do you have a lot of DATA statements? Also is it the EEPROM that is full or your variable memory? On the BS2 you only have 26 bytes of memory to store variables in.
  • Craig EidCraig Eid Posts: 106
    edited 2009-04-03 21:46
    Kelly,

    Which·Stamp you are using?·You can optimize your EEPROM usage on the BS2e, BS2sx, BS2p, BS2pe, and BS2px by subdividing your program into smaller files and utilizing the 8 program slots. For more information view the [noparse][[/noparse]Compiler Directives] in the Help file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ························ Craig Eid


    ··········· Triad Research and Development
    Electical Engineering Design and Consulting Services

    ··················· www.TriadRD.com
Sign In or Register to comment.