Entering Data Using The Keyboard - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM

3.11 Entering Data Using the Keyboard

3 - 37
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
Example
10 INPUT A
20 INPUT B
30 PRINT A+B
40 END
RUN
? 6
BASIC is asking for the value of A. For example, if "6" is the value
for A, input "6" and press the Enter key.
? 10
Similarly, BASIC is asking for the value of B.
16
For example, input "10" and press the Enter key.
OK
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.
Variable name in which to place data
BASIC waits until the
Enter key is pressed.
MELSEC-Q
3 - 37

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents