Mitsubishi — Chapter 7 Application Instructions API 50-88

7 Application Instructions API 50-99 API 71 Operands: S : Start device for key scan input D 1 : Start device for key scan output D 2 : Device for storing keyed-in value D 3 : Key output signal Explanations: 1. S will occupy 4 consecutive points. 2. D 1 will occupy 4 consecutive points. 3. D 3 will occupy 8 consecutive points. 4. See the specifications of each model for their range of use. 5. For SA series MPU, S , D 1 and D 3 do not support E, F index register modification. 6. Flags: M1029 (On whenever a matrix scan period is completed); M1167 (HKY input modes switch). See remarks 7.

This instruction designates 4 continuous external input points starting from S and 4 continuous external input for more details. points starting from D 1 to construct a 16-key keyboard by a matrix scan. The keyed-in value will be stored in D 2 and D 3 is used for storing key status. If several keys are pressed at the same time, the first key pressed has the priority. 8. The keyed-in value is termporarily stored in D0. When the 16-bit instruction HKY is in use, 9,999 is the maximum value D0 is able to store. When the value exceeds 4 digits, the highest digit will overflow. When the 32-bit instruction DHKY is in use, 99,999,999 is the maximum value D0 is able to store.

When the value exceeds 8 digits, the highest digit will overflow. 9. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time. Program Example: 1. Designate 4 input points X10 ~ X13 and the other 4 input points Y10 ~ Y13 to construct a 16-key keyboard. When X4 = On, the instruction will be executed and the keyed-in value will be stored in D0 in bin form. The key status will be stored in M0 ~ M7. X4 DVP-PLC APPLICATION MANUAL 7-76 Mnemonic Operands Function D HKY Hexadecimal Key Input Type OP Bit Devices Word Devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F HKY: 9 steps DHKY:

17 steps S * D 1 * D 2 * * * * * D 3 * * * PULSE 16-bit 32-bit SA SX SC EH SV EH3 SV2 ES EX SS EH3 ES EX SS EH3 ES EX SS SA SX SC EH SV SA SX SC EH SV SV2 SV2 HKY X10 Y10 D0 M0