11 - 92 11 - 92
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
IPUT$
Function
INPUT $
• Returns a character string of the specified length after reading from the keyboard of the
console.
• Returns a character string of the specified length after reading from a sequential file.
• Returns a character string of the specified length after reading from the communication
port of the communication module.
INPUT$ ( <numeric expression> )
INPUT$ ( <numeric expression> , # <file number> )
INPUT$ ( <numeric expression> , % <port number> [, <wait time> ] )
numeric expression
• • • •
Specify the length of a character string to be read.
file number
• • • •
Specify the file number of the sequential file that was
opened by the OPEN instruction
port number
• • • •
Specify the port number of port opened by the
ZOPEN instruction.
Syntax
wait time
• • • •
Specify the wait time for the data entry from the
communication port in seconds.
A$=INPUT$(3)
• • • •
Reads three characters from the keyboard at the
console and assigns them to A$.
B$=INPUT$(10, #1)
• • • •
Reads ten characters from the sequential file opened
by the file number 1, then assigns them to B$.
Examples
C$=INPUT$(7, %1, 20)
• • • •
Reads seven characters from CH1(RS-232C) of the
communication module and assigns them to C$.
“Time out error” occurs if twenty seconds elapses
before reading seven characters.
Description
• The INPUT$ function reads and returns number of characters specified by <numeric
expression> from the keyboard, sequential file, or a communication port.
• <numeric expression> specifies the length of character string to be read.
Specify the length from 1 to 255 range.
Reading from the keyboard
• If nothing is specified after <numeric expression>, input from the keyboard specified by the
ZIDV instruction is accepted.
• All of the keys except for the following keys or codes can be read from the keyboard that is
specified as the console.
Ctrl + C , Ctrl + S , Break key (Processes exactly as key operation.)
Codes that correspond to 00
H
, 80
H
, and FD
H
to FF
H
• All the keys can be entered from the keyboard other than the console’s keyboard (a
console connected to the communication port), except for the keys that correspond to the
00
H
code and keys that correspond to the DC1/DC3 codes that were specified by the
ZCNTL instruction.