Remote Processing RPC-210 User Manual
Page 14

SAVING CODE AND DATA
BASIC
SECTION 3
Page 3-1
Figure 3-1 Flash E PROM location
INTRODUCTION
SAVING COD E AND DATA IN BASIC
S E C T IO N 3
Code and data are saved to external Flash at U6 only.
Some of the internal Flash/EE PROM to the ADUC 812
CPU is used when running RPBASIC-52. C ontact
Remo te Pro cessing for mor e details. Data is usua lly
saved to the 512K RAM, but can be saved to Flash for
secure storage or when R AM is not enough.
One BASIC progr am can call another using the
EXEC UTE command.
Despite the fact you have a 512K RAM installed, the
maximum pr ogram size RPBA SIC-52 can run at one
time is about 6 0K (including r oom for some va riable
storage). H owever, up to 7 programs can be chained.
C h a in e d p r o gr a m s c a n r u n a n ot he r p ro g r am .
One program can call another using the EXECUTE n
command. n is from 1 to 7.
NOTE: When a program calls another, the old program
is completely replaced. All variables and
arrays are clear ed (set to 0).
To keep variables, you m ust save them before calling the
new progr am. When the new program is running, these
variables may be restored. Use PEE K and POKE type
commands to read and save numbers and strings. See
SECTION 5, STORING VARIABLES IN RAM for more
information. The demonstration programs EXECn.BAS
show how a variable is stored in RAM.
A Flash EPROM is non-volatile (retaining data even
when power is disconnected), having an unlimited
numbe r of re ad cycles an d a limited nu mber of write
cycles.
A pro gram is not run fr om E PRO M. It is transfer red to
RAM and run from there . Pr ograms in RAM can be
modified. They ca n be saved to E PRO M for auto
execution later.
NOTE: Starting sometime in 2012, the flash EPROM
type will change from the Atmel 29C040A to a
t r ad it io n al fl a sh . S av in g an d lo a di ng p r og r a m s
will rem ain the sam e. H owever , an y data
stored in the same seg ment as a p rogr am w ill
be erase d when stor ing a new p rogr am. This is
impor tant if storing m enu strings and constants
i n t he s am e f la s h s e gm e n t a s th e pr o g ra m .
The RPC-210 can be set to autorun on power up or reset
by groun ding J7-17 (usu ally to J7-15). When a utorun is
on, the progr am in E PRO M segm ent 1 is loaded into
RAM and begins to execute immediately.
SAVING A PROGRAM
For this example, assume you wanted to save the
f o ll ow i ng p r og r a m :
20 FOR N=0 TO 2
30 PRINT "Hello ",
40 NEXT
50 PRINT
If this progr am is not alr eady in, type it in now (or , if
you prefer, use your own progr am).
Type in the following command:
SAVE
RPBASIC-52 r esponds with:
Saving 35 bytes
-OK
The time it takes save a program depends upon the
length and complexity of the program and Flash EPROM
type. Pr ogramm ing rate is roughly 10000 bytes/second.
If the program is not successfully saved to EPROM, an
error message will appear.
Saving a pr ogram overw rites the pr evious one. Ther e is
no way to recover the old one since both occupy the
same space.
Using SAVE without any parameters is the same as
typing SAVE 1.