Shop OBEX P1 Docs P2 Docs Learn Events
More Memory — Parallax Forums

More Memory

EMPTY_CEMPTY_C Posts: 29
edited 2008-04-20 22:49 in BASIC Stamp
Hey all,
···· I am trying to save data that is coming from the BS2 chip onto an external eeprom such that i can read the data later...·i was wondering if there was some well written and understandable code such that i can program it to work?

···· I was also wondering if it were possible to use an external eeprom to store my code on and run.· Lets say i run out of room on the chip is it possible to just have it read the code from the external chip? (if i had more $ i would buy a better stamp but all i am stuck with right now is the BS2)

Thanks
MT

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-20 19:12
    It IS possible to use an EEPROM for external data, but you have to use SPI (SHIFTIN/SHIFTOUT) to read and write it.

    And no, you can't expand internal eeprom -- the BS2 run-time only knows about 2KBytes at a time. 'Bigger' BS2's have multiple 2K 'pages' you can use with the "RUN" keyword.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-20 19:14
    There are several articles in the Nuts & Volts columns that are downloadable from Parallax. Go to their main webpage. Click on the Resources tab and you'll see Nuts & Volts Columns. All of the articles include sample code.

    You can't really use external EEPROM for storing programs. Theoretically, you could copy code from external EEPROM to the internal EEPROM for execution, but it's a very slow process and only works on the Stamps with several "banks" of program memory (called "slots"). Even with the Stamps with more memory, you're still limited to 2K bytes per "slot".
  • ercoerco Posts: 20,260
    edited 2008-04-20 19:34
    MT: Mike Green's a Stamp Guru, he's throwing you gold. Check www.parallax.com/dl/docs/cols/nv/vol2/col/nv71.pdf for info on Stamps with banks of more memory. And brand new BS2E Stamps are on eBay for $20 delivered since Parallax blew them out. Time to pounce on one of those.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • EMPTY_CEMPTY_C Posts: 29
    edited 2008-04-20 19:40
    so there is no way that i can read in instrctions from the external eeprom?· Ex. Program the stamp to read the external eeprom and execute that code? I have see articles where people read numerical data from an external eeprom and used the DAQ program to plot it... wouldn't that work the same way?· and in reference to Mr. Greens response... how slow is slow??



    MT
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-20 19:48
    No, there is no way you can read in instructions from external eeprom, write them to internal eeprom, and execute them.

    Yes, you CAN read and write data from external eeprom, but you can't effectively execute them.
  • EMPTY_CEMPTY_C Posts: 29
    edited 2008-04-20 20:11
    do you know of any attempts to?? how in efficient would it be if it were possible?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-20 20:47
    Yes, there's several people who try this every year, and no it's not possible.

    The BS2 runs using a "PBasic" run-time interpreter, with tokens kept in eeprom. The run-time interpreter is hard-coded to know what to do with 2k of external eeprom -- that's about it.

    So, bottom line, if you want to use the PBasic run-time, you're limited to those 2K byte pages.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-20 22:49
    With the multi-slot Stamps, you can write a program that copies a program from any of a variety of sources (EEPROM, communications, SD card file) to one slot of the EEPROM. It takes about 5ms per byte or 10 seconds for the whole slot to write the information to the EEPROM. Using the RUN statement, you can transfer control to the other slot. For short programs, you don't have to write the whole thing which saves some time.

    Writing data to an EEPROM takes about the same time (roughly 5ms per byte). There are some speedups where you can write more than one byte at a time to a buffer in the EEPROM, then commit it to the memory array. The buffers vary from 64 to 256 bytes in size depending on the EEPROM capacity and the manufacturer and the whole buffer gets written at once (in roughly 5ms).

    Reading is faster, limited by the I2C serial protocol and the execution speed of the program being used. The Stamp Manual gives some I2C speeds for those Stamps that have I2C statements built-in (like the BS2p/pe/px). For the others, you'd have to figure out the subroutine execution speed yourself.
Sign In or Register to comment.