Remote-processing BASIC 52 Manuale Utente Pagina 5

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 163
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 4
RPBASIC-52 PROGRAMMING GUIDE
1-2
Basic Interpreters
There are several ty pes and levels of inte rpreters. A
slow, very basic type of interpreter figures out what
each command is sup posed to do during run time. A
token-based interpreter, such as this basic, is much
faster. This type examines each program line as it is
typed in, figures out what it should do, and converts
it to a string of B asic tokens m ixed w ith text. A
token is a single character that represents a
command. For example, an ASCII value of 89H
represents the PRINT com man d.
After a line is p rocess ed, it is stored in mem ory.
When you type the RUN command, each program
line is scanned. A token causes a branch to an
assembly language routine which carries out the
required action.
ELEMENTS OF A BASIC PROGRAM
Commands
Com mands direct or perform an output ac tion.
Exam ples are PR INT, SAV E, PO KE, a nd LO AD .
Commands do not return a value used for
computation.
Functions
Functions return a value u sed for c omputation .
Exam ples are AIN , PEE K, SIN , and COM $.
Functions do not cause a change in an output.
Line Numbers
Program line s begin with a unique line number.
Each line number m ay contain on e or more B asic
statements separated by a colon. Line num bers are
in the range of 1 - 65535.
Operators
Operators act on or convert num eric or s tring da ta.
These include arithmetic (+,-,*, and /), natural
logarithmic (base "e"), trig (SIN, COS), relational
(>, <, or <>), logical (.AND., .OR., .XOR.), and
string (ASC, STR) functions. Special operators
control the hardware-specific features of RPBASIC-
52 such as interrupts, timers, counters, and direct
read/write of I/O ports.
Tasking Statements
Tasking statements define a condition and execution
location when a condition is m et. Statements
include ON COM $, ON LINE, ON COUN T, and
ONITR. Programs executed as a result of these
statements are treated as subroutines. The only
difference between a tasking routine and one called
by a GOSUB is the tasking can be called at any
time.
Expressions
An expression is a combination of instructions,
operators, data (constants, arrays or strings) and
variables which, when evaluated by B asic, is
equivalent to a single numerical value. Many Basic
comm ands accep t expressions as well as explicit
data. Expressions which are used by commands and
functions are also called arguments.
WRITING AND EDITING PROGRAMS
Program development takes place on your PC using
your word processor or the RPC card. Programs
from your PC are downloaded using a serial
communication program.
Each progra m line can co ntain at most 79 characte rs.
Program lines can be entered in any sequence.
RPBASIC-52 properly orders line numbers.
Multiple statements on a single line are allowed
when statements are separated by colon (:) and do
not exceed a total of 79 cha racters per program line.
Ending a program line with a colon may cause a
program to hang.
There are two ways to write Basic programs. The
first way is to directly type in the program to the
card. All standard Remote Processing cards have a
means of sto ring pro grams to a flash type EPR OM .
The second way is use a text editor and download
the resulting file to the system. Just be sure to save
files in DOS text format.
Downloading programs means transferring them
from your PC (or MAC or term inal) to the card.
Uploading means transferring them from the card
back to the PC.
When uploading or dow nloading files, select A SCII
text format. XMODEM , YMODEM , or other
formats are not used. RPBASIC-52 does not know
when you are typing in a program or if something
Vedere la pagina 4
1 2 3 4 5 6 7 8 9 10 ... 162 163

Commenti su questo manuale

Nessun commento