2 - 4 2 - 4
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
2.2 Direct Mode and Program Mode
• Direct mode
When a BASIC instruction is entered and the Enter key is pressed while “OK” is
displayed on the console screen, BASIC will execute the instruction immediately.
This is referred to as execution in direct mode.
The results of the operation executed in direct mode will remain in memory, but the
instruction line will be cleared.
All BASIC instructions with the exception of DEF FN can be executed in direct
mode.
• Program mode
Entering a BASIC instruction preceded by a line number and pressing Enter will
store the instruction in the memory of the communication module. Lines are
comprised of line numbers and BASIC instructions, and a group of more than one
line is referred to as a BASIC program (or simply, a program).
A program is comprised of statements that specify a series of operations that the
computer performs. Designing and testing a program is referred to as
programming. Programs stored in memory can be executed by entering the RUN
instruction of BASIC.
This execution is referred to as program mode execution, as opposed to direct
mode execution.
2.3 Line Format
Lines are the smallest components of a program and are comprised of one <line
number>, a sentence, and a Return symbol that indicates the end of the line.
A sentence is a collection of <statements> that make sense as an instruction. ( Return
is entered by pressing the Enter key while editing the program.)
The line format is as follows:
Sentence
<Line Number> [<Label:>] <Statement> {:<Statement> } Return
(1) Line Number
<Line Numbers> are written from the 1st column of the line and are represented
by whole numbers between 1 and 65529 (decimal constant).
The line numbers are placed in ascending order within the program.
Line numbers act as indices for controlling program execution, and at the same
time, as line search indices when editing the program.