3 - 37 3 - 37
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.11 Entering Data Using the Keyboard
There are two methods to notify data entered via keyboard to BASIC. One method is
using the INPUT instruction, which BASIC pauses the program and waits for an input.
The other is the function INKEY$ that simply checks for keyboard status and doesn't
stop the program.
The INPUT instruction is used when you wish to pause the execution by BASIC while
data is being entered.
The INPUT instruction is used as follows.
INPUT Variable name in which to place data
Example
BASIC is asking for the value of A. For example, if "6" is the value
for A, input "6" and press the Enter key.
Similarly, BASIC is asking for the value of B.
For example, input "10" and press the Enter key.
10 INPUT A
20 INPUT B
30 PRINT A+B
40 END
RUN
? 6
? 10
16
OK
BASIC waits until the
Enter key is pressed.
Sometimes it is difficult to understand what BASIC is asking for, if only '?' is displayed
on the screen. Therefore, there is a function to specify a character constant. See the
program below.
Example
10 INPUT " A=" ;A
20 INPUT " B=" ;B
30 PRINT A+B
40 END
RUN
A=?6
A=?10
16
OK
As shown above, it's now clear as to what the program is asking for when a character
constant is placed in front of the variable name separated by a semicolon.
Содержание 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...