beautypg.com

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

Page 98

background image

RPBASIC-52 PROGRAMMING GUIDE

2-79

PEEKF

Syntax:

PEEKF(segment,ad dress)
Where: segment = 0 to 7, specifies a 64K segment

address = 0 to 65535, byte address in a segment

Function:

Reads a floa ting point num ber from R AM. Flo ating point range is + /- 1E-127 to +/-
0.99999999E+127

Mode:

Comm and, Run

Use:

A = P E E K F (1 , A D )

Cards:

All

D E S C R IP T I ON

T h i s f u nc t io n is u se d in c o nj u nc t io n w it h P OK E F . D at a is r et r ie v e d f r om a n y m em o r y l o ca t io n . P E E K F
retrieves a floating point number saved by POKE F.

PEEKF can access up to 512K of ram by selecting a segment and an address. A segment selects a 64K block
while the address selects a location within this block.

Each floatin g poin t num ber req uires 6 bytes. address must be inc reme nted in dexe d 6 byte s for eac h valu e.
See POKEB and POKEF com mands for addressing and segment info.

RELATED

POKEF

ERRORS

B A D S Y N T A X

If B, segment, or address is missing.

BAD DATA

If segment is > 7, or address > 65535

EXAMPLE

The follow ing exam ple reads the A -D port, multiplies it by a constant, and sa ves it to RA M. The v alues are
then retrieved and printed back.

10 FOR N=0 TO 500
20 A = AIN(1) * 0.2344
20 POKE F1,N*6,A
30 NEXT
40 FOR N=0 TO 500
50 A=PEEK F(1,N*6)
60 PRINT A,
70 NEXT