beautypg.com

Hkey: 16-key input, Example, Description – KEYENCE Visual KV Series User Manual

Page 155

background image

2.4 Instruction Details

1

2

3-131

Chapter 2 Instructions

HKEY: 16-Key Input

Reads hexadecimal key data on time-
sharing basis and outputs these data to
special utility relays 2900 to 2915.

FUN

SET

1

L D

7

HKEY

nnnn

mmmm

0005

HKEY

0000
0500

Input relay

Output relay

Line No.

Instruction

Operand

0000

LD

0005

0001

HKEY

0000 0500

COM

24
VDC

+

-

000

001

KV

002

003

0

COM

500

501

502

503

4

8

C

1

5

9

D

2

6

A

E

3

7

B

F

Pressing two or more keys
simultaneously is OK.
(With diode)

Pressing two or more keys
simultaneously is invalid.

:

ON: Key input read operation has
completed.

Relay No. 2900

2901

2902

2903

2904

2905

2906

2907

2908

2909

2910

2911

2912

2913

2914

2915

Hex key

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

ON: Pressing two or more keys
simultaneously is not valid.

R: Reading

W: Writing

Example

Coding

Description

When input relay 0005 turns ON, the operand hexadecimal key data is read.

HKEY instruction employs four inputs and four outputs arranged as shown below.

➮ Refer to "Fetching 16-key input" (p. 3-133) for the programming example.

The HKEY instruction employs four input relays and four output relays from the
specified number.

Inputs are processed on a time-sharing basis, so that input processing requires 8
scan time cycles (approx. 160 msec when the scan time is 20 msec or less).

When a hexadecimal key is pressed, the HKEY instruction turns ON the corre-
sponding special utility relay (2900 to 2915).

The special utility relay status indicates whether two or more keys can be
pressed simultaneously or whether a key input read operation has completed, as
shown in the following table:

Note 1: An HKEY instruction can be defined only once in a program.

Note 2: The HKEY instruction turns output relays ON/OFF every scan time. Connect
the device with transistor output.

Note 3: If the scan time is shorter than 8 ms, set the input time constant smaller
than the scan time.

Relay No.

2814 R/W

2815 R

Status

HKEY

KVNKA Chap 02_4bP.p65

08.3.11, 0:00 PM

131