beautypg.com

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

Page 6

background image

RPBASIC-52 PROGRAMMING GUIDE

1-3

else (la ptop o r main fram e) is sen ding it c harac ters.
The upload and download file does not contain any
special codes; they are simply AS CII characters.

Uploading programs is simply a process of receiving
an ASC II file. You or your program simply nee d to
s e nd " LI S T" to re c ei ve th e en ti re p ro g ra m .

Downloading a program requires transmitting an
ASCII file. As you type in (or download) a line,
RPBAS IC-52 tokenizes that line. The time to do
this depends upon its complexity and how many
lines of code have been entered.

RPB ASIC-5 2 must finish co mpiling a line b efore
starting the next one. When a line is compiled, a ">"
character is sent. This should be your terminal
programs pacing character when downloading a
p ro g ra m .

If your comm unications progra m canno t look for a
pacing prompt, set it to delay transmission after each
line is sent. A 100 ms delay is usually adequate, but
your program may be lo ng and com plex and require
more tim e. A result of short transm ission time is
missing or incomplete program lines.

A technique used to further program documentation
and reduce c ode space is the use of com ments
(REM) in a downloaded file. For example, you
could have the following in a file written on your
editor:

REM C heck position

REM R ead output from the pot and
REM calculate the position

2200 a = ain(0) :REM Get position

The first 3 com ments dow nloaded to the c ard
are ignored. Similarly, the empty lines between
comm ents are also ignore d. Line 2200, w ith its
comment, is a part of the program and could be
listed. The m ajor penalty by w riting a program this
way is increased download time.

Notice that you can write a program in lower case
characters. RPBASIC-52 translates them to upper
case.

Some p rogramm ers put "NE W" as the first line in
the file. During deb ugging, it is comm on to insert
"tempora ry" lines. This ensure s that these lines are

gone. Dow nloading tim e is increased w hen the old
progra m is st ill prese nt.

If you like to write programs in separate modules,
you can dow nload them separately. M odules are
assigned blocks of line numbers. Start up code
might be from 1 to 999. Interrupt handling (keypad,
serial p orts) m ight be from l ines 10 00 to 14 99.
Display output might be from 1500 to 2500. The
programmer must determine the number of lines
required for each section.

RPBAS IC-52 automatically formats a line for
minim um code space. For exa mple, you c ould
download the following line of code:

10 fora=0to5

When you listed this line, it would appear as:

10 FOR A=0 TO 5

Spaces are displayed but not stored. The following
line:

10 for a = 0 to 5

would be compressed and displayed as in the second
examp le above. Spac es are remo ved. How ever,
spaces as part of a remark or PRINT are not
removed.

RPBAS IC-52 contains no line renumbering
capability.

RPBAS IC-52 contains a rudimentary line editor
which allows editing a program line until a carriage
return is sent. The rubout or backspace key can be
used to delete c haracters wo rking backw ards form
the current chara cter. After a line is entere d, it
cann ot be e dited; y ou m ust ent er an e ntire ne w line .
Deleting an undesired line is done by typing the line
number followed by a carriage return. RPBASIC-52
automatically deletes all such lines.

Upperca se/Lower case

RPB ASIC -52 is ge nerally not ca se-sen sitive.
Program o r comm and lines m ay be entered in
lowercase or uppercase; ho wever they are (with
some exceptions) converted to upp ercase. The case
of text in remarks and strings is preserved.