Serial eeprom chapter 13 – Remote Processing RPC-30 User Manual

Page 36

Advertising
background image

SERIAL EEPROM

CHAPTER 13

Page 34

RPC-30

DESCRIPTION

The serial EEPROM is a 128 byte, non-volatile device
that stores your pr ogram s parame ters. Strings, intege rs,
and floating point numbers can be saved to EEPROM.
Information such as calibration constants, recipes, RS-
485 address, or other "soft" inform ation that may change
over time should be stored in the serial EEPROM.

The LOAD # and SAVE # commands are used to get
and store data to and fr om the EE PROM . T he syntax is:

SAVE #address
LOA D #addr ess

Where addr ess is the location in RAM. address is in the
range of &8000 to &F FFF . Take ca re to make sure you
are not POKEing into program or reserved memory
addresses. U se the SYS(1) and SYS(2) functions to the
address es for fr ee space. LOA D and SA VE ef fectively
require 128 bytes of free RAM . The L OAD # com mand
reads 128 bytes from the serial EEPROM and transfers
this information starting at the address specified.

An EEPROM is more secure than battery backed RAM
because it is more difficult to write to it. Several
microprocessor instructions must take place before a
byte is change d. R AM , on the other h and, requir es only
a momentary pulse to modify its memor y.

Each byte can be written to 10,000 times and r ead from
any number of times. The EEP ROM could be updated
once a day f or over 27 year s before this limit is
exceeded.

Do not constantly store information to the EEPROM.
That is, do not continuously write to it once a second as
part of your program . This is one electronic part you
c a n " w e ar o ut " .

PROGRAM EXAMPLE

The following pr ogram example saves and retrieves a
string and a number to the serial EEPROM.

100 'Save to EEPROM
110

'Put string of known length to RAM

120 A$ = ">03"
130 C = 14.35
140 POKE$ &E000,A$
150

'Put a number to RAM

160 FPOKE &E020,C
170 'Save to EEPROM
180 SAVE #&E000

200 'Load from EEPROM
210 LOAD #&E000
220 'Now put info in variables
230 B$ = PEEK$(&E000)
240 D = FPEEK(&E000)

When sa ving strings, the amou nt of mem ory r equired is
1 + the string length. Floating point numbers require 6
bytes, integers r equire on ly 1 byte. You m ay find it
desirable to make a "me mory" map of the data types you
wish to save. You can " stack" d ifferent kin ds of data
next to each other (strings, integers, floating point
numbers) so long as you know where you are saving and
r e tr i ev in g th e m .

Advertising