314
4
4 Instructions4.12.2 Bit Switch Access
To input
2013
, press keys ② ,
0
8
,
① , and ③ (X2, X0, X1, and X3) in sequence. The following gure shows
the actions of the PLC's internal variables.
X
0
X
1
X2
X
3
M
0
M
1
M2
M
3
M10
ķ
ĸ
Ĺ
ĺ
ķĸĹĺ
Key output
X20
The BCD value is converted to a BIN
equivalent, which is stored in D0
Ă
Ă
If the 32-bit instruction DTKY is used, D1 occupies a 32-bit variable, that is, D1 and D0 in the preceding example, which
correspond to the higher and lower bytes respectively.
HKY: Hexadecimal key input
◆
Overview
The HKY instruction assigns a 4- or 8-digit hexadecimal value to a word element through a 4x4 input matrix
and drives the corresponding bit elements to act.
HKY S D1 D2 D3
Hexadecimal
key input
Applicable model:
H3U
S
Input port head
address
Head address of four consecutive bit elements
occupied by the key input port
16-bit instruction
(9 steps)
HKY: Continuous
execution
32-bit instruction
(17 steps)
DHKY: Continuous
execution
D1
Gating bit
element head
address
Head address of four consecutive bit elements
occupied by the gating port
D2
Data storage
unit
Address of the word element that stores key inputs
in the range 0 to 9999, or 0 to 99,999,999 when the
32-bit instruction is used.
D3
Input signal
indicator
Head address of eight consecutive bit elements that
store the actions corresponding to key input
• Based on parameter setting, X0 to X11 represent
numeric keys 0 to 9, and M0 to M9 indicate the key
status. When any key is pressed, the key output unit
M10 is set.
• The key value (for example, 2013) is converted to a
BIN value and then stored in the specied D1 (D0 =
0x7DD), which remains unchanged even when the
driver ow switches to OFF.
• When multiple keys are pressed, the rst detected
key is active. When the input number has more than
four digits, the rst digit overows and only the last
four digits are retained.