View Full Version : from Ram to Eeprom
04-10-2007, 07:02 PM
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,... [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
04-10-2007, 09:14 PM
Look at the READ / WRITE / DATA statements in the PBasic manual.
04-11-2007, 02:57 AM
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.
04-11-2007, 03:29 AM
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".
04-11-2007, 03:31 AM
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:
IF temp <> newValue THEN
This obviously won't help you if the value is constantly changing.
04-11-2007, 05:41 AM
Ah, great minds think alike, and within two minues of each other, too.