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.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...