Shop OBEX P1 Docs P2 Docs Learn Events
storing RAM data in the EEPROM — Parallax Forums

storing RAM data in the EEPROM

dartecdartec Posts: 6
edited 2011-03-01 10:39 in BASIC Stamp
I am trying to store on EEPROM data that my Bluetooth unit attached to a Basic Stamp has received over the radio link and kept on RAM. Of course I want the program to do it automatically without human intervention.
Does anyone know how to do that?
Thanks a lot,
Angel

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-02-28 15:54
    PBASIC Help: WRITE and (READ) ?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-28 15:58
    The only thing to be really careful about is that EEPROM locations can only be written a certain number of times, then they "wear out". It's about 100,000 times. It seems like a lot, but it's easy for a program to exceed this over a period of days to months.
  • dartecdartec Posts: 6
    edited 2011-03-01 09:39
    Thanks, Mike and PJ. I have tried several times using the WRITE command, to no avail. When, after running the program, I go into memory map, there is no data on EEPROM locations 0 to 17. What am I doing wrong?. Here is the code,basically connecting with a bluetooth device and storing the address on EEPROM (or trying to...).


    ...// INITIALIZATION
    SERIN 0,84, [STR bBuffer\17]
    SEROUT 1, 84, [CR]
    SERIN 0,84, [WAIT(">")]
    DEBUG CR, STR bBuffer\17, CR // Here I display the BT address before connecting
    SEROUT 1, 84, ["con "]
    SEROUT 1, 84, [STR bBuffer\17] // Here I connect (after the routine connectionWait) which I can confirm it works since the devices light up
    SEROUT 1, 84, [CR]
    DEBUG CR, "writing eeprom", CR
    FOR i = 0 TO 17
    WRITE i, bBuffer(i) // Here I try to write onto EEPROM
    NEXT
    GOSUB connectionWait
    DEBUG "Connection established.", CR
    RETURN

    connectionWait:
    IF (IN5 = 0) THEN connectionWait
    RETURN
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-01 10:18
    The Stamp Editor's memory map will never show anything written by a program. It only shows the program itself and data loaded with the program by using a DATA statement.

    You have to write another program to READ the data and display it. The data will remain in the EEPROM unless it's changed by another program or overlaid by the data from a DATA statement.
  • dartecdartec Posts: 6
    edited 2011-03-01 10:39
    Mike,
    Well, that explains things. In other words, the data has been written onto EEPROM with the WRITE statement, but the Edtor's map does not show it. OK, thanks a lot for the information. Angel
Sign In or Register to comment.