Remote-processing RPC-2300 Manual de usuario Pagina 15

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 36
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 14
CHAPTER 5 DATA MEMORY
RPC-2300 Page 13
backup RAM when pow er is off. Battery life will
depend upon RAM size, type, temperature, 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, arrays, recipes, and formulas as applied to your
application.
Programs and CA MBASIC II variables reside in
segment 0. Your var iables are generally stored in
segment 1 and higher. 32K of RAM 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
statements. Each segment has an address range from 0
to 65535.
PEEK and POKE commands store and retrieve values
from memory. 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
examples. A list of comm ands appea rs at the end of this
chapter.
CORRUPTED VARIABLES
RAM may 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
POKE' d data is susceptible to corruption. This is
especially true when the board is powered down. The
DS-1213C monitors 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 power down could interrupt a saving
process. The 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 out.
If the program was POKEing 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,
POKEd variables are called sets because data can consist
of a mixture of variables, strings and arrays.
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. When
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 triplicate set is used to recover the last set or indicate
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 (POKE' d) in three different places.
Assume that the constant was assigned address 0, 100,
and 200 in segment 1. The data is POKEd to address 0
first, then 100, then 200.
Vista de pagina 14
1 2 ... 10 11 12 13 14 15 16 17 18 19 20 ... 35 36

Comentarios a estos manuales

Sin comentarios