Mitsubishi QD51 Programming Manual page 79

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

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM
Full-byte characters
(Kanji characters)
cannot be used as
an input with the
INKEY$ function.
3 - 38
The INPUT instruction pauses the program until data is entered and the Enter key is
pressed. When you don not wish to pause the program, the INKEY$ function is used.
the following shows an example program:
Example
10 A$=INKEY$
20 PRINT A$
30 GOTO 10
RUN
No output is displayed on the screen even after execution.
Now press the A key.
A
"A" is displayed on the screen when the A key is pressed.
A
When the A key is released, the screen will be blank again.
As you can see, the INKEY$ function checks for the keyboard status and the program
is not be paused. The INKEY$ function uses an empty as the value, and uses the text
as the value when a key is pressed. However, since this value is a character string,
the substituted variable must be a character variable or a character array.
Furthermore, unlike the INPUT function, multiple characters cannot be input once.
Example
10 N=0
20 PRINT "Count in progress"
30 N=N+1
40 K$=INKEY$
50 IF INKEY$= "Y" THEN GOSUB 70
60 GOTO 30
70 PRINT "N= ";N;"
80 RETURN
RUN
Count in progress.
N = 30.
N= 530.
If the INKEY$ function is used to wait for an input as
shown below, the efficiency of multitask execution may
be degraded.
Use the INPUT$ function in the following case
Y
Press the
key.
Press the
key.
Y
10 PRINT "Press the Y key."
20 K$=INKEY$
30 IF K$= " Y" GOTO 50
40 GOTO 20
50 END
10 PRINT "Press the Y key."
20 K$=INPUT$(1)
30 IF K$<> " Y" GOTO 20
40 END
MELSEC-Q
3 - 38

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents