beautypg.com

Kv -300, 2 high-speed counters, Programming exmaple – KEYENCE Visual KV Series User Manual

Page 318

background image

6.2 High-speed Counters

KV

-300

KV-10/80

3-294

6

Chapter 6 Interrupts, High-speed Counters, Positioning Control

2002

INITIAL SETUP FOR HIGH-SPEED COUNTER/COMPARATOR

#00010

CTC1

#65535

CTC0

CTH0

2100

#65535

CTC2

#65535

CTC3

CTH1

0500

2008

#08000

DW

DM0000

#00700

DW

DM0001

#00400

DW

DM0002

#04000

DW

DM0003

(SET ) (SET )

2813

2105

STARTS POSITIONING

0003

0000

1001

DIFU

1001

$0268

LDA

2100

STA

01

CALL

(SET ) (RES )

1200

CTH1

(RES )

CTH0

(RES )

EI

2105

0001

( )

0502

EMERGENCY STOP

0003

(SET)

2105

END

CTC0,CTC2,DM0011, CALCULATION SUBROUTINE

SBN

02

2002

#01000

LDA

#10000

MUL

DM0012

DIV

#00005

ADD

#00010

DIV

CTC0

STA

DM0010

STA

#00010

LDA

#10000

MUL

DM0010

DIV

#00005

ADD

#00010

DIV

DM0011

ADD

CTC2

STA

DM0011

STA

INITIALIZING SUBROUTINE

RET

SBN

01

DM0003

LDA

CTC3

STA

#00002

DIV

DM0004

STA

DM0001

LDA

DM0012

STA

#00000

DW

DM0011

2002

02

CALL

RAMP UP/DOWN CHECK ROUTINE

SBN

03

RET

DM0012

LDA

#00100

DIV

DM0011

ADD

DM0004

CMP

2002

0001

0002

0003

0004

0005

0006

0007

0008

0009

0010

0011

0012

0013

0014

0015

0016

0017

0018

0019

0020

0021

0022

0023

0024

Generates clock pulse through high-
speed counter CTH0.

Counts clock pulese through high-
speed counter CTH1.
• CTC0: Pulse cycle

CTC1: Pulse width

• CTC2: Frequency change point

CTC3: Positioning pulse total
count

Sets parameters (DM0000 to
DM0003).

Reverse output

Emergency stop
Sets CTC0.
Setting value of CTC0 =
1 ÷ DM0012 x 10

3

x 10

3

÷ 6.4

Sets CTC2.
• DM0010: Pulse cycle T (µs) x 10
• DM0011: Accumulated pulse count
• DM0012: Current frequency f [Hz]
• 1200: Acceleration flag

Programming exmaple

KVNKA Chap 06.p65

08.3.11, 0:10 PM

294