Shop OBEX P1 Docs P2 Docs Learn Events
using WRITE to save SERIN strings from PINK module — Parallax Forums

using WRITE to save SERIN strings from PINK module

adamblakeadamblake Posts: 3
edited 2009-10-19 14:58 in BASIC Stamp
Is it possible to read a string from the PINK module via SERIN
and store the string in EEPROM via the WRITE command with a bs2

I'm running out of variable RAM really fast and I am hoping
I can store a string into an EEPROM memory location directly.

Is this even possible? I'm a bit unfamiliar with the flexibility of
SERIN and new to the bs2 in general.

Thanks for any help,

-Adam

Comments

  • dev/nulldev/null Posts: 381
    edited 2009-10-19 11:05
    Yes, that's excactly how you would use WRITE. WRITE can store up to Word size variables, so you can't store a string directly, you'll have to store each character with a WRITE statement. The WRITE statement needs to know where you want to store your information, so you provide an EEPROM address with the statement. You can start at address 0. Beware that the Stamp EEPROM also contains the Stamp program itself, starting at some specific location (look in the doc). I think for BS2, this is at 2048. If you WRITE to that address or above, you will overwrite the Stamp program and things will go bananas.

    For example:
    mybyte VAR Byte(3)

    mybyte(0) ="A"
    mybyte(1) ="B"
    mybyte(2) ="C"

    WRITE 0, mybyte(0)
    WRITE 1, mybyte(1)
    WRITE 2, mybyte(2)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-19 14:58
    Also, very important, an EEPROM location can only be written a certain number of times. Usually this is on the order of 100,000 times. More than that and the EEPROM location begins to wear out. It becomes unreliable for writing. 100,000 seems like a lot, but when a program is doing it constantly, it can happen in a matter of days. Usually you run into this when a program that writes to EEPROM has a bug so that it writes to EEPROM when you don't expect it or it writes to the same location when you think you've set it up to use several different locations.
Sign In or Register to comment.