beautypg.com

2 interrupt with a high-speed counter, Visual kv series – KEYENCE Visual KV Series User Manual

Page 223

background image

3.4 Applications of Interrupt Programs

3-199

Visual KV

Series

1

3

Chapter 3 Interrupts

0001

0002

0003

0004

0005

0006

0007

0008

0009

0010

2008

EI

2002

HSP

0004

2002

CTH0
0004

# 10000

CTC0

CTH0

RES

0500

SET

2103

SET

2002

0500

RES

0000

END

INT

CTC0

RETI

ENDH

3.4.2

Interrupt with a High-speed Counter

Outline
Uses the input value of a high-speed counter from one input relay and the ON/OFF
status of another input relay to control the ON/OFF status of an output relay.

Example: Filling control for medicine (tablets)

Ladder diagram

Output relay 0500 turns ON when the input value of the high-speed counter from
input relay 0004 reaches "10000".

Output relay 0500 turns OFF when input relay 0000 turns ON.

Sensor

When power is turned on, an EI
instruction enables interrupts.
Sets automatic reset of CTH0.
Resets current value of CTH0.

ON

OFF

ON

OFF

ON

OFF

ON

Output 0500

Scan

Input 0004

Input 0000

Sets an input time constant of
input 0004 to 10 µs.

Turns OFF output 0500 when
input 0000 turns ON.

Executes an interrupt when the
input value of CTH0 reaches
"10000". Turns ON output 0500.

Specifies CTH0 as the high-
speed counter for input 0004 and
sets "10000" as the preset value
of CTC0.

Visual KV

KVNKA Chap 03.p65

08.3.11, 0:05 PM

199