
DATA MEMORY CHAPTER 5
Page 12 RPC-150
Figure 5-1 Data memory
INTRODUCTION
The RP C-150 is available with 32 of RAM . RAM is in
socket U1. RA M may be battery backed by installing a
DS-1213C in socket U1. RAM is installed on top of U1.
Battery life depends upon RAM power consum ption,
temperature, and amount of time the board is operating.
Generally, a battery life from 5 to 10 years can be
expected.
This chapter discusses installing a battery backup for
RAM, saving and retrieving variables, and running
assembly language programs. Figure 5-1 shows the
location of U1.
If program and data are battery backed, the UNNEW
command may be used to restore the program.
Variables used by the Basic program are cleared,
however. Data POKEd into RAM is saved.
BATTERY BACKUP
A Dallas Semiconductor DS-1213C is used to battery
backup RAM when power is off. Battery life depends
upon RAM size, type, and time the RPC-150 has power
applied to it. You can expect the battery to last between
5 to 10 years at 25°C. Battery life decreases by 1/2 at
50°C.
To install a DS-1213C, r emove the RAM chip in U1,
install the DS-1213C, 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.
Program s, CA MBASIC variables, and variables you
POKE and P EEK to are fr om 8000H to FF FFH . The
program and b asic numb er variables (A, B(15), ect.)
are ' on top' of the program and are cleared on reset.
String variables (e.g. c$) are below the stack. The stack
requires 255 bytes and string space will depend upon
how much you CLEARed on power up. If you do not
use the CLEAR statement, assume 500 bytes are
available for strings. Data you peek and poke to must be
between the end of num ber variables and start of strings.
The procedure to determ ine the 'safe' area to Poke
variables follows. First, download and run your
program. What you want to do is for ce the basic to
allocate space for most all of the variables in your
program. Next, exit your program and perform a
PRIN T SYS(2), SYS(1) in the immediate mode. T his
will print out the address for the bottom of the stack and
top of the program with variables. Subtract the number
used in your CLEAR statement from the first number
printed. If you did not use the CLEAR statement,
subtract 500. In case your progr am did not execute
completely, you may w ant to add 500 to the second
number. This range is where you can PO KE to.
Many times you will start with a very small program and
add to it. In this case the above procedure is not
adequate. The best w ay to handle this situation is to
figure out the number of bytes used for string variables
in the program. This determined by the CLEAR
statement. If you do not use the CLEAR statement, then
you can figure the bottom of the stack and string space
start at address 0FD00H. When you start using POKE
statements, assign new variables BELOW this address.
To put it another way, count down and not up as you add
POKE locations. Remember when using string and
floating point POKEs the address specified is the starting
address and will go up.
PEEK and POKE commands store and retrieve values
from memory. For example:
20 POKE 60000, A
puts the value of A into address 60000.
Use the PEEK statement to retrieve the variable:
Commenti su questo manuale