beautypg.com

Rpbasic-52 programming guide, Pokef, Warning – Remote Processing BASIC 52 User Manual

Page 103

background image

RPBASIC-52 PROGRAMMING GUIDE

2-84

POKEF

Syntax:

POKEF segmen t,address,d ata
Where: segment = 0 to 7, specifies the 64K segment

address = 0 to 65535, location in segment to save to
data = + / - 1 E - 12 7 to + / - 0 . 99 9 9 99 9 9 E +1 2 7 , n u m b er t o s a v e t o R A M

Function:

W r it es a f lo a ti ng p oi nt nu m be r t o R A M .

Mode:

Comm and, Run

Use:

P O K E F 1 ,A D , D A

Cards:

All

D E S C R IP T I ON

Use PO KEF to w rite floating point num bers into RA M. Program "constants" suc h as calibration tab les are
saved to batte ry bac ked R AM .

WARNING:

RPBAS IC-52 does not check the address. It is possible to poke into the program, stack, or
variable areas. Results are unpredictable. Poke into mem ory above MT OP for safest
operation.

Each floating point numb er requires 6 bytes of R AM. W hen storing to R AM, sep arate addresses by at least 6
bytes. address i s t he s ta r ti ng a dd re s s i n R A M . D a ta is w ri tt e n t o f ro m address to address + 6. For exam ple, if
the first address was 0, the next is 6, third 12, and so on. An easy way to calculate an address is to use an
index number and multiply it by 6. By adding a constant, different sections of RAM may be used. See the
POKEB command for segment and address information.

RELATED

P E E K F

ERRORS

B A D S Y N T A X

If W, segmen t, address, or data is missing.

BAD DATA

If segment is > 7, address or data > 65535 or negative

EXAMPLES

The follow ing exam ple takes data from an analog inpu t, multiplies it by a con stant, and saves it to seg ment 1
o f t he 1 28 K R AM .

1000 FOR N = 0 TO 7
1010 POKE F1,N*6+100,AIN(N)*1.2383
1020 NEXT

The equa tion "N*6" is a n index m ultiplier.

T h e n e xt ex a mp le p ri nt s o u t t he d at a f ro m R A M.

500 FOR N = 0 TO 7
510 PRINT PEEKF(1,120+N*6)
520 NEXT

The expre ssion "120+N *6" perform s two functions. First, 120 is a fixed offset into RA M. This offset is
necessary when allocating sections of RAM for storage parameters (strings, byte data, and other floating point
numbers). "N*6" indexes the floating point num ber into RAM so it does not overwrite other valid numbers.