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

Page 58

Advertising
background image

RPBASIC-52 PROGRAMMING GUIDE

2-39

EXAMPLE

The following example gets characters from the receive buffer and generates a checksum. A string of 10
characters is entered at com port 0.

10 STRING 200,20
20 PRINT "Type in 10 characters. Characters are not echoed"
30 IF COM(0) < 10 THEN 30
40 $(0) = com$(0)
50 CKSUM = 0
60 FOR N = 1 to STR(0,$(0))
70 CKSUM = CKSUM + ASC($(0),N)
80

NEXT

90 PRINT "Checksum of incoming string:",CKSUM

>run

Type in 10 characters. Characters are not echoed
(1234567890 are entered at the keyboard)
Checksum of incoming string: 525

Advertising