3 - 3 3 - 3
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.1 Creating a Program
In order to create a program, it is necessary to make the console usable first.
Start up the system so that AD51H-BASIC can be used on the console.
The outline of the system startup procedures are described in Section 2.1. See the
user's manual for each communications module for details.
Verify that the console screen displays the following :
The flashing mark is called the cursor.
OK
"OK" denotes that AD51H-BASIC is waiting for an instruction from you, the user. Now,
enter the following :
NEW Enter
NEW is an instruction that clears all programs from the memory. If a previous program
is still left when a new program is being written, they will get mixed with one another.
Therefore, it is always necessary to execute the NEW instruction.
Now, the console is ready for program creation. Enter the following program.
10 REM Calculation of compound interest
20 INPUT "Principal=";M
30 INPUT "Interest rate=";R
40 INPUT "Period=";K
50 RR=R/100
60 G=M(1 +RR) ^ K
70 PRINT "Interest included=";INT(G); "YEN"
80 END
It is necessary to place line numbers when entering instructions in a program. The
AUTO instruction is a convenience as it displays line numbers automatically. Enter the
following instruction.
AUTO Enter
The screen changes as shown below.
10
REMARK
If the screen displays "Syntax error" when you press the Enter key, it means that
there was an syntax error in the instruction you have just entered. Try entering it
again.
Also, if you have pressed a wrong key, press the Back Space key. If it was before
pressing the Enter key, the cursor will move back for one character and you can
correct your error.