Rpbasic-52 programming guide, Peekw – Remote Processing BASIC 52 User Manual
Page 99

RPBASIC-52 PROGRAMMING GUIDE
2-80
PEEKW
Syntax:
P E EK W (segment,ad dress)
Where: segment = 0 to 7, specifies a 64 K segm ent.
address = 0 to 65535, w ord address in a se gment.
Function:
R e a d s a n u ns i gn e d 16 b it n um b e r f r om R A M
Mode:
Comm and, Run
Use:
A = P E E K W ( 0, A D )
Cards:
All
D E S C R IP T I ON
Use this function in conjunction w ith POK EW . Data is retrieved from any mem ory location as a sin gle 16 bit
(2 byte) num ber. Num bers in the range o f 0 to 65535 are retriev ed. Two by tes of data are requ ired for data
retrieval.
PEEKW 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.
See POKEB for addressing and segment information.
RELATED
POKEW
ERRORS
B A D S Y N T A X
If W, segment, or address is missing.
BAD DATA
If segment is > 7, or address > 65535
EXAMPLE
This exam ple takes 500 rea dings from an alog input 0, saves it to se gment 1 o f a 128K R AM, an d then prints
out all of the values
10 FOR N=0 TO 500
20 POKE W1,N*2,AIN(0)
30 NEXT
40 FOR N=0 TO 500
50 A=PEEKW(1,N*2)
60 PRINT A,
70 NEXT