Shop OBEX P1 Docs P2 Docs Learn Events
from Ram to Eeprom — Parallax Forums

from Ram to Eeprom

DaimonDaimon Posts: 2
edited 2007-04-10 21:41 in BASIC Stamp
hi there

well, I'm working with a Basic Stamp 2 sx (BS2sx) and an ADC 16-bits. I have a problem.
I'd like to transfer the data stored in the ram from the ADC (shiftin) to the EEPROM.

The program is like this:

value VAR Word

Shiftin data,... [noparse][[/noparse]value\17]

I'd like to transfer the "value" word from the Ram to the EEPROM location for example 0.

Does someone know which syntaxe is necessary to do that?

Thanks in advance

Daimon

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-10 13:14
    Look at the READ / WRITE / DATA statements in the PBasic manual.
  • DaimonDaimon Posts: 2
    edited 2007-04-10 18:57
    Hi
    thanks for answering. Read and write are the syntaxes I tried but I didn't understood why I couldn't see it in the memory map (stamp editor). If I correctly read the manual, variables in the memory aren't shown, even if you put a direct variable in it.

    But thanks for the response.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-04-10 19:29
    The "memory map" is a picture, made by the IDE, of what the IDE is going to put into the memory of the BS2.

    So, if you specify a 'DATA' statement, that data should show up in the "memory map". If you merely specify an address in your code that you're going to WRITE to, well, the IDE doesn't know about that, and so doesn't put that in the "memory map".
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-10 19:31
    If you initialize a data area in EEPROM with the DATA statement, it will show up on the memory map. The editor doesn't know where the READ / WRITE statements will get/put their data, so it can't show that in the memory map.

    I suggest that you use the DATA statement (with a label on it) to define the area(s) in EEPROM that you're going to use. It helps insure that these areas are at the beginning of the EEPROM (the program is at the upper end).

    Be careful how you use the WRITE statement since you can "wear out" an EEPROM location with excessive (more than about 100,000) writes. In a program where this is done in a loop, you can wear out a location in a couple of hours. The best way to avoid this is to compare the current content of the location with the variable you want to store. If they're already equal, don't do the WRITE like:
    READ location,temp
    IF temp <> newValue THEN
       WRITE location,newValue
    ENDIF
    


    This obviously won't help you if the value is constantly changing.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-04-10 21:41
    Ah, great minds think alike, and within two minues of each other, too.
Sign In or Register to comment.