Remote Processing RPC-220 User Manual

Page 23

Advertising
background image

RAM

SECTION 5

Page 5-1

RAM

S E C T IO N 5

This section discusses accessing RAM and battery
backup.

ACCESSING RAM

RAM is accessed using MOVX type instructions. T he
I/O control bit (C PU p ort P4 .0) m ust be high. This bit
is high on pow er up or reset.

The 805 1 series of C PU' s access RA M 64K bytes at a
time. Additional RAM is accessed using a bank
selection sche me. Bank selection in the RPC -220 is
done by wr iting to an I/O addr ess.

Demonstration program MEM220.C accesses all RAM
segments. Byte and word w ide accesses are through
functions speek, spoke, speekw , and spokew.

On power up or reset, RAM segment is set to 0. To
change the RAM segment, do an I/O write to addr ess
0xcYzz

Where:

0xc is the constant part of the addre ss
Y

determ ines the segm ent selected ac cording to
the formula below.

zz

is don't care data.

Simply w riting to this addr ess sets the segm ent. No data
is involved. Use the following formula to calculate the
address based on the segment desired:

address = 0xc000 + segment * 0x800

The best w ay is in assem bly language . T his is shown in
the speek and spoke type routines in MEM220. C under
the ME M220 director y. E ssentially, DPH is loaded with
the addre ss after shifting (multiplying) th e segme nt.

You can use either compiler supplied peek and poke
functions or a pointer to ac cess RAM in segment 0. Use
caution when using these functions to access other
segments. N ormally, C stores variables in segment 0.
If you have code like:

CLR P4.0

// set I/O mode

poke(addr1,value1); // set segment
SETB P4.0

// Back to RAM mode

poke(addr2,value2); // Save memory

All of the variables, unless they are register, are bogus
since they w ere obta ined from the wro ng segm ent in
R A M .

WARNING:

Turn off interr upts befor e accessing R AM in
segments 1-7 unless you make your handlers switch
to segment 0. You can use ser iously wrong
variable s if the progr am assum es they ar e in
segment 0 and you are working another segm ent 1.

WARNING:

When you are logging data and are in the
development mode, you can easily modify the code
in segment 0. C ode starts at 0x8000. Start logging
data in segment 1.

BATTERY BACKUP

The RPC-220 comes in two versions with battery backed
RAM . Battery backup is controlled by the RTC chip U8.
The supplied battery can expect to back up RAM and
keep the clock going for about 4-6 years with a 128K
R A M , t h e u n it co m p le t el y o f f, a n d s it ti ng a t 2 5 °C .
Battery life degrades quickly, about 50%, at 50°C. You
can extend battery back up life by installing your own.
See SECTION 7, EXTERNAL BATTERY, for more
information.

RAM SIZE JUMPER

Jumper W1 con figures R AM U4 for 128K or 512K. It is
preset at the factory.

APPLICATION PROGRAMS

The following program s are in the MEM 220 directory.

F i le n am e

Description

M E M 22 0. C

Extended m emory access routines.

M E M TS T2 2. C

A slow, but extensive m emor y test.
All 512K R AM checked. Prim arily to
check for overlapping memory
segments.

Advertising