Shop OBEX P1 Docs P2 Docs Learn Events
Eeprom help! — Parallax Forums

Eeprom help!

HenrymouHenrymou Posts: 128
edited 2007-02-28 04:55 in Robotics
Uh, my cartographer robot's program is gettin' pretty huge.
SO huge in fact that I am not sure that the entire program can fit into the Basic stamp's EEPROM
Does anyone know how to store a PBasic program in an external EEPROM chip?
please help!
synopsis science fair is looming around the corner, and I want that money!
$$$
PLEASE HELP! freaked.gif

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-27 04:05
    You can't store a PBasic program in an external EEPROM chip. You've got 2K if you have a BS2. Other Stamp models have "slots" which each store a 2K program and you can transfer back and forth using common variables to communicate. This issue has come up over and over again and usually there are ways to "get the fat out" of existing programs. Often repeated pieces of code can be made into subroutines. Sometimes parts of a program can be made "table driven".
  • HenrymouHenrymou Posts: 128
    edited 2007-02-27 04:17
    ok, I get what you are saying, buy what do you mean by gettin' the fat out?
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-27 15:16
    "get the fat out" means to use more efficient programming (replace repeated code sequences with calls to a subroutine, use table-driven techniques instead of code, put long output strings into 'data' statements and output them with a subroutine call, etc.)

    It's not possible to store 'program code' into an external eeprom and have the BS2 use it. You CAN use an external SPI interfaced EEPROM (24LC640 or so) to write result data out to. And there are BS2 'flavors' that have multiple 2K byte 'slots' you can use -- you can't make simple subroutine calls across slots, but this space can be used via the "RUN" keyword, and some clever programming.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-27 15:38
    "get the fat out" meant that most programs have "fat" in them where there are sections that are nearly identical that can be made into subroutines (thereby nearly halving the space needed). There are often multiple output statements like SEROUT with identical literal strings that could be put into DATA statements and output with a subroutine possibly saving some space. Often re-thinking parts of a program will show commonality that can be used to save space. Sometimes complicated program logic can be represented in tables and a small "interpreter" for the tables can do the work with a tremendous savings in program size.

    It is very rare that a program can't be made significantly smaller when re-thought / re-written. Experienced engineers often talk about "throwing one version away" when they can afford to do so given whatever constraints there may be on a project. The second version is the result of the learning process in constructing the first version. There's a particular mindset you have to get where you back up and look critically at Version One and non-judgmentally say to yourself "OK, How would I have done that better?".
  • HenrymouHenrymou Posts: 128
    edited 2007-02-28 04:53
    oh, you mean like the SELECT-ENDSELECT commands?
  • HenrymouHenrymou Posts: 128
    edited 2007-02-28 04:55
    Well thanks guys, I don't really know ASCII code so if my project's program is too big, I will just add my second BS2, thanks!
Sign In or Register to comment.