beautypg.com

Visual kv series – KEYENCE Visual KV Series User Manual

Page 274

background image

4.7 Examples of Direct Clock Pulse Output

3-250

Visual KV

Series

4

Chapter 4 High-speed Counters

The input enable relay for CTH0 must be ON all the time when CTH0 is used to output the
clock pulse.

The input enable relay for CTH1 must be ON all the time when CTH1 is used to count the
clock pulse.

Specifies the internal clock (2101) as the clock input for CTH0. Specifies 0500 as the
clock input for CTH1. With this setting, CTH0 is used to output the clock pulse, and CTH1
is used to count the clock pulse.

Specifies the number of clock pulses to the CTC2 preset value.

The clock pulse output starts when input 0000 is turned ON.
To restart the clock pulse output after it stops, turn ON input 0000 again.

Coding

Tips
Special utility relays 2103 through 2111 can be turned ON/OFF by using the LDA
and STA instructions instead of the SET-RES instructions.
The example program below can be changed as follows by using the LDA and STA
instructions. The number of lines and steps can be reduced.

LDA $0268
When LDA $0268 is executed, the value specified by the operand is written into
the internal register as follows.

When STA 2100 is executed, the value in the internal register is assigned to
special utility relays 2100 through 2115.

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2008

0024

SET

2203

0001

EI

0025

CON

0002

CON

0026

DW

#00000 DM1940

0003

MPS

0027

CON

0004

SET

2103

0028

SET

2813

0005

CON

0029

CON

0006

RES

2104

0030

RES

CTH1

0007

CON

0031

LD

0000

0008

SET

2105

0032

DIFU

1000

0009

CON

0033

CON

0010

SET

2106

0034

AND

1000

0011

CON

0035

RES

2105

0012

RES

2107

0036

LD

2002

0013

MRD

0037

CTH

0 2101

0014

RES

2108

0038

CTC

0 #00050

0015

CON

0039

CTC

1 #00020

0016

SET

2109

0040

LD

2002

0017

CON

0041

CTH

1 0500

0018

RES

2110

0042

CTC

2 #10000

0019

CON

0043

END

0020

RES

2111

0044

INT

CTC2

0021

CON

0045

LD

2002

0022

RES

CTH0

0046

SET

2105

0023

MPP

0047

RET1

0048

ENDH

0

0

[0]

[2]

[6]

[8]

0

0

0

0

1

0

0

1

1

0

1

0

0

0

Internal register

0

15

xx

14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

0

0

0

0

0

1

0

0

1

1

0

1

0

0

0

Special utility
relay 21xx

2109

SET

2110

RES

2111

RES

CTH0

RES

2203

SET

2813

SET

CTH1

RES

2104

RES

2105

SET

2106

SET

2107

RES

2108

RES

2103

SET

EI

2008

2100

STA

CTH0

RES

2203

SET

2813

SET

CTH1

RES

$0268

LDA

EI

2008

KVNKA Chap 04_2.p65

08.3.11, 0:08 PM

250