Remote Processing RPC-210 User Manual

Page 16

Advertising
background image

SAVING CODE AND DATA

BASIC

SECTION 3

Page 3-3

Using HIDE with RTC serial number
Each real time clock (RTC) has a unique serial number
associated w ith it. T his serial num ber m ay be used in
conjunction with your program to make sure a board was
not purchased from us and your system copied.

When u sed with H IDE , it bec omes ex trem ely difficult to
virtually impossible for someone to simply copy a
system since the serial num ber in your pr ogram is also
hidden.

See RTC-4.BAS and READING CLOCK SERIAL
NUM BER in SECT ION 7 for a little more inform ation.

SAVING AND READING DATA

Data is saved to and read from F lash EPROM using
BSAVE a nd BLOA D com mands. Any nume ric (bytes,
words, and floating point numbers) and string data can
be saved and read back. Data may be stored in Flash as
p a r t o f a d a ta lo g gi ng p r og r a m .

The Flash EPROM has a limited number of write cycles
(1000 - 10, 000) per 256 byte secto r, so writing data
should be kept to a minimum. D ata may be read from
Flash an unlimited nu mber of tim es.

NOTE: Future R PC-210 versions will change the F lash

EPROM type. The new type will be a
traditional flash. Major difference is sector
size will be 64K bytes instead of 256 bytes.
Another difference is the flash must be erased
before over -writing existing data. Curr ent flash
type (29C 040A) allow s overw riting in 256 b yte
sectors. Basic BSAVE com mand will be
modified to include an er ase option (E ) that will
erase the entire flash . C ontact Rem ote
Processing for mor e information.

Remembe r that your program is stored in segment 1.
RPBASIC-52 is stored in segment 0. Segments 2-8 may
be used to store programs also. Make sure you do not
write ov er your progr ams. A safe m ethod to saving d ata
is to start in segment 2 (assuming there is no program
there) and go up from there.

Data can not be POKE ’ed directly Flash EPRO M).
When accessing data from EP ROM , add 8 to the
segment specified by the comm and. Com mands u sed to
read from EPR OM are:

PEEKB

PEEKW

PEEKF

PEEK$

See SAV_LOD. BAS in the BASIC52 directory for an
example of how these comma nds are used.

Data must be put into RAM first before it can be written
to Flash. Writing to F lash is done in 256 byte sectors.
If you wan t to save just 1 byte, 256 bytes ar e written to
at a time.

When sp ecifying a w rite addr ess, the form at should be in
0XX00H . ‘X X’ is any valid hex addr ess. T he least
significant byte should be 00.

Keep in mind wr iting takes about 50 mS/ 1000 bytes.
During BSAVE , interrupts ar e recognized but not
serviced. If these commands must be serviced quicker,
write data in blocks of 256 bytes. It takes a little over
1 0 m S t o w r i te f ro m 1 to 2 56 b yt e s o f da t a. T h e 10 m S
time is a ‘burn’ time for the Flash.

Block Data Transfer

Blocks of data are transferred to and from RA M and
Flash EP ROM using BLOAD and BSAVE comma nds.
Block transfers are useful for loading and storing data,
look-up tables, text, etc. U p to 65,535 bytes can be
moved from RAM to EPROM or EPROM to RAM at
one time. T he absolute number of bytes that can be
moved is limited by the R AM a nd EPR OM sizes.

Transfers from EPRO M to RAM , using BLOA D, take
approximately 23.5 m s/1000 bytes. T ransfers from
RAM to EPROM , using BSAVE , are even longer at 75
mS/1 000 bytes.

Serial port, tick timer, and external interrupts are
enabled dur ing these tra nsfers. Howe ver, response s to
ONT ICK or ONIT R are d elayed by the time it takes to
transfer data. W hen ONTIC K or ONIT R must be
serviced faster, transfer data in sm aller blocks.

Refer to BLOAD and BSAVE in Appendix A for more
information.

ASSEMBLY LANGUAGE INTERFACE

Assembly langua ge progr ams are placed in the Flash
EPR OM . W hen using RP BASIC -52, progr ams shou ld
s ta r t a t a d dr e ss 7 00 0 H or h ig h er u p t o F F F F H .

Code development can take place in a number of
different ways. Contact Remote Processing technical
support for ways appropr iate to your situation.

Advertising