3 - 5 3 - 5
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.2 Executing and Editing a Program
3.2.1 Executing a program
Let's execute the program that you entered in Section 3.1. Enter the following while
"OK" is displayed on the console.
RUN Enter
The RUN instruction is used to execute the program stored in the memory. The screen
should display the following.
OK
RUN
Principal=?
The program shown in Section 3.1 calculates a compound interest. The text
'Principal=?' is caused by the INPUT instruction in line 20, which lets BASIC ask 'How
much is the principal?' Now enter the following.
10000 Enter
This means that you have told the program "the principal is 10,000 yen." Now the
console will display 'Interest Rate=?' and 'Period=?.' Enter 5 Enter and 3 Enter in
the same way. This means 'the interest rate is 5%' and 'the period is 3 years.' After the
entry to 'Period=?' is finished, the screen will display the following message and the
execution of the program is ended.
Interest included=11576 yen
OK
(This means that if 10,000 yen is invested at an annual compound rate of 5% for 3
years, the interest included is 11,576 yen.)
3.2.2 If an error occurs
There are cases, after a program is executed using the RUN instruction, a message
like the one shown below is displayed and the execution is stopped.
in NNNN
OK
This means that BASIC is telling you that an error is present in the program and it
cannot be properly executed.
The
part of the message is called an error message. It indicates the kind of
error present. The NNNN part tells you the line that contains the error.
See Appendix 4.4 for details on what each error message means.