Remote Processing RPC-2300 User Manual
Page 15
CHAPTER 5
DATA MEMORY
RPC-2300
Page 13
backup R AM when pow er is off. Battery life w ill
depend upon RAM size, type, tem perature, and time the
SBS-2300 has power applied to it. You can expect the
battery to last between 5 to 10 years for operation at
25°C. At 50°C, life is about 1/2 as much.
To install a DS-1213D, r emove the RAM chip in U2,
install the DS-1213D, and install the RAM chip on top of
the module.
STORING VARIABLES IN RAM
The term "var iables" in this context includes numb ers,
strings, arr ays, recipes, and formulas as applied to your
application.
Prog ram s and CA MBA SIC II va riables r eside in
segmen t 0. Y our var iables are genera lly stored in
segment 1 and higher. 32K of R AM is available for
your program and variable storage in segment 0. The
program and basic variables (A, B(15), C $, etc. ) always
reside in segment 0 and are cleared on reset. Variables
you peek and poke to usually reside in segment 1 and
above. Var iables referenced by peek and poke
s ta t em e n ts . E a ch s eg m e nt ha s an a dd r e ss r an g e f r om 0
to 65535.
PEEK and PO KE commands store and retrieve values
from memor y. For example:
20 POKE 12,A,1
puts the value of A into segment 1, address 12.
Use the PEEK statement to retrieve the variable:
50 B = PEEK(12, 1)
You can store and retrieve arrays, strings, and variables
in this way. There ar e many variations of PEE K and
POKE statements. Refer to the CAMBA SIC II
Programming Manual for additional information and
examp les. A list of comm ands appea rs at the end of this
chapter.
CORRUPTED VARIABLES
RAM m ay be battery backed using a Dallas
Semiconductor DS-1213D Smartsocket. W hen your
application must rely on the accuracy of data after power
up, corr upted variables becomes a possibility.
The nature of RAM is it is easily written to. Any
POK E' d data is susceptib le to corr uption. This is
especially true when the board is powered down. The
DS-1213C m onitors the supply voltage and turns off
writing when it is below about 4.65 volts. However,
when POKE ing long data, such as strings and floating
point numbers, a pow er down could interrupt a saving
process. T he result is information is corrupted. A
scenario is explained below.
A program is running and POKEing data into RAM. At
the same time it is poking, a reset occurs. A reset can
occur due to power loss, someone pushing the reset
button, or a wa tchdog time r time o ut.
If the program was P OKEing a string (POKE $), floating
point number (FPOKE), double byte (DPOKE ), or arr ay
while the reset occurred, the data became corrupted.
This is because the complete value was not saved.
Since it is impossible to predict or delay a reset, a work
around is to duplicate or triplicate POKEd values. That
is, you would have to save the same information in two
or three different places. F or purposes of discussion,
POKE d variables are called sets because data can consist
of a mixture of va riables, strings and arr ays.
On power up, your program would compare values from
one set to the other one or two. If the two (or three)
agreed, then there was no corruption and the program
can reliably use the values. In practice, you would read
information from set 1, but would save data to all two or
three.
The use of duplicate or triplicate sets depends upon what
the system must or can do if data is corrupted. W hen
using a duplicate set, a corrupted set indicates that
default values (from the program) should be used, since
it is uncertain if the first or second set is corrupted.
Both data sets would then be re-initialized.
A triplica te set is used to r ecover the last set or ind icate
that the data in the first set is valid. The pr ocedure and
logic is as follows.
Data is written to each element in a set in a specific and
consistent order (data to an entire set does not have to be
written to, just that element). For example, a calibration
constant is saved (POK E' d) in three different place s.
Assume that the constant was assigned address 0, 100,
and 200 in segment 1. The data is PO KEd to addr ess 0
first, then 100, then 200.