312
Using the Instruction If
the input word for connecting the 10-key keypad is specified for IW
, then opera
-
tion will proceed as shown below when the program is executed.
0 0 0 0 0 0 0 0
0
0 0 0 0 0 0 1
0
0 0 0 0 0 1 0
0
0 0 0 0 1 0 2
0
0 0 0 1 0 2 9
D
1
+1 D
1
(1)
(2)
(3)
(4)
(1) (2) (3) (4)
00
01
02
09
00
01
02
09
10
to
IW
to
Input
from 10-key
Turn
ON flags
corre
-
sponding to 10-key
inputs (The flags re-
main ON until the
next
input.)
ON
if a key is
pressed.
D
2
Before
execution
“1”
key input
“0” key input
“2” key input
“9” key input
Flags ER: Indirectly
addressed
DM word is non-existent. (Content of
:
DM word is
not BCD, or the DM area boundary has been exceeded.)
D
1
and D
1
+1 are not in the same data area.
Example In
this example, a program for inputting numbers from the 10-key is shown. As
-
sume that the 10-key is connected to IR 000.
TKY(––)
000
DM1000
DM1002
25313 (Always ON)
@XFER(70)
#0002
DM1000
DM 0000
00015
The
10-key information input to IR 000
using TKY(––) is converted to BCD and
stored in DM 1000 and DM 1001. Key information is stored in DM 1002.
IR 00015 is used as an “ENTER key”, and when IR 00015 turns ON, the data
stored
in DM
1000 and DM 1001 will be transferred to DM 0000 and DM 0001.
Advanced I/O Instructions Section 5-28