Remote Processing RPC-210 User Manual

Page 27

Advertising
background image

RAM

BASIC

SECTION 5

Page 5-2

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.

RESERVED MEMORY

Generally, writing to RAM segm ent 0 should be
avoided.

The upper 256 bytes of RAM in segment 0 are set aside
for system use and should not be used to POKE
variable s. A void wr iting to addre sses 0FF 00H to
0FFFFH, especially when writing to Flash EPROM.

Program s and RPBASIC-52 var iables reside in segment
0. W riting to them could corrupt the program and/ or
variable data.

Data using PEE K and PO KE com mands a re gene rally
stored in segment 1 to 7 (a segment is 64K of memory).

COMMANDS

The following is a list of RPBASIC-52 commands used
with RAM and Flash EPROM.

Command

Format

BLOAD

Transfers data from EPROM to RAM

BSAVE

Transfers data from RAM to EPROM

CALL

Calls an assembly language routine

PEEK B

Return s a byte

PEEK F

Returns a floating point number

PEEK W

Returns a 16 bit number

PEEK $

Returns a string

POKE B

Stores a byte to RAM

POKE F

Stores a flo ating point num ber to
RAM

POKE W

Stores a16 bit number to RAM

POKE $

Stores a string to RAM

XBY

Reads or writes external mem ory,
segment only.

NOTE: Futur e version (Per haps starting in 2012) will

have an enhanded BSAVE com mand. The
newer BSA VE com mand will have an erase
flash sector capability. Contact R emote
Processing for mor e information.

Advertising