Visual kv series – KEYENCE Visual KV Series User Manual

Page 248

Advertising
background image

4.4 Expanded Functions of High-speed Counters

3-224

Visual KV

Series

4

Chapter 4 High-speed Counters

4.4.3

Application Example of 24-bit High-speed Counter
(single-phase input)

The following is a ladder program using a 24-bit high-speed counter and high-speed
counter comparator with a preset value of "1000000".

1) Sets CTH0 as the 24-bit high-speed counter with the MEWSW instruction. (Turn

on 3 of SW3.)

2) When power is turned on, writes the preset value "1000000" of the high-speed

counter comparator (CTC0) and sets the value with the STA CTC0 instruction.

3) Sets the input time constant of input relay 0004 to 10 µs.

4) Counts pulses at input relay 0004 with high-speed counter CTH0.

5) Defines a dummy high-speed counter comparator.

6) Reads the current value of CTH0 into data memory DM0000 (low-order bits) and

DM0001 (high-order bits) each scan time.

2008

CTH0

RES

0008

CTC0

STA

DM1916

STA

#16960

LDA

DM1917

STA

#00015

LDA

2002

DM0000

STA

DM1900

LDA

DM0001

STA

DM1901

LDA

2002

0002

0001

HSP

0004

2002

0003

0004

CTH0

0004

0006

END

0007

0005

ENDH

#65535

CTC0

2)

1)

3)

4)

5)

6)

MEMSW

$0800

Low-order 16 bits of
current value of high-
speed counter

High-order 16 bits of
high-speed counter
comparator

Low-order 16 bits of
high-speed counter
comparator

Writes preset value of
high-speed counter
comparator

High-order 16 bits of
current value of high-
speed counter

KVNKA Chap 04_1.p65

08.3.11, 0:06 PM

224

Advertising