Block data transfer – Remote Processing RPC-330 User Manual
Page 20

RAM MEMORY
SECTION 5
Page 5-3 RPC -330
Figure 5-2 RPBASIC-52 memory map
T h e hi gh e st ad d r es s i n a 3 2K R A M sy s te m is 7 F F F H .
Many times it is desirable to store an array containing a
"mixed" set of variables. Suppose you needed to save an
array m ade up of the following elem ents:
Bytes
Type
Description
1
Byte
Job counter
2
Word
Analog output offset
6
Floating
Corr ection factor
20 String
J o b n a m e
Total number of byes required for each array is 30 (add
1 for a < CR> at the end of the string).
The Job c ounter is inc rem ented ever y time it is
completed. A nalog output offset is an output constant or
other var iable used to initialize the outputs. Job name is
used with the display to identify a job.
For this example, suppose there are 20 of these arrays
that need to be set up. A program fragment is as
follows:
100 STRING 400,20 Initialize 20 string arrays
300 NO = 12
Elem ent to fill
310 CF = 23.432
Corr ection factor
3 2 0 J C = J C + 1
Job counter
330 AC = 25
Analog offset
350 GOSUB 1000
500 NO = 5
Element to retrieve
510 GOSUB 2000
Retrieve variables
This subroutine stores variables CF, JC, A C, and string
$(1) into an array starting in segment 1, address 0.
1000 POK EB1, 30*NO, JC
1010 POKEW1,30*NO+ 1,AC
1 0 20 P O KE F 1 , 3 0* N O + 3 , C F
1030 POKE$1, 30*NO+ 9,$(1)
1040 RETURN
S u br o ut in e 20 0 0 - 20 4 0 r e tr i ev e s d a ta in to v ar i ab le s C F ,
J C a nd A C .
2000 JC = PEEKB(1,30*NO)
2010 AC = PEEKW (1,30*N O+ 1)
2020 CF = PEEKF (1,30*N O+ 3)
2030 $(1) = PEEK$(1, 30*NO+ 9)
2040 RETURN
You can store and retrieve strings and other kinds of
variables in this way. There ar e many variations of
PEEK and POKE statements. Refer to the RPBASIC-52
Software Supplement in this manual for additional
information and examples. A list of commands appears
at the end of this section.
BLOCK DATA TRANSFER
Blocks of data are transferred to and from RA M and
flash EPR OM u sing 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 100
ms/ 1000 bytes usin g a 512K byte EPR OM . T his time is
even longer when smaller E PROM s are used (due to the
program ming algorithm).
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.