Kv -300 – KEYENCE Visual KV Series User Manual

Page 297

Advertising
background image

6.1 Interrupt Instructions

KV

-300

KV-10/80

3-273

1

6

Chapter 6 Interrupts, High-speed Counters, Positioning Control

Interrupt routine coding

Example 2

Features of INT0003

Upon generation of interrupt by INT0003, the CTH1 current value is automatically
transferred to TM30.
Interrupt generated by any of INT0000 to INT0002 is executed at the rising edge of
the input signal. Interrupt generated by INT0003 can be executed either at the rising
or falling edge of the input signal.

In the example program below, pulse width of input 0003 is measured.

Coding

0003

Pulse width

ON

OFF

2206(OFF)

2206(ON)

2008

1

EI

$0000

LDA

2200

STA

DM0000

STA

2002

2206

2206

TM30

LDA

TM02

STA

TM30

LDA

TM02

SUB

DM0000

STA

CTH1

2200

END

INT

0003

KEEP

SET

2206

RES

RETI

ENDH

2

3

4

(a)

(b)

Relay No.

ON

OFF

2206

Executes interrupts at falling edge of

Executes interrupts at rising edge of

input pulse to 0003.

input pulse to 0003.

INT / RETI

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2008

0008

OUT

0500

0001

EI

0009

END

0002

CON

0010

INT

0000

0003

SET

2813

0011

LD

2002

0004

LD

1000

0012

OUT

1000

0005

OR

0500

0013

RETI

0006

TMR

000 #00020

0014

ENDH

0007

ANB

T000

Line No.

Instruction

Operand

Line No.

Instruction

Operand

0000

LD

2008

0014

CON

0001

EI

0015

STA

TM02

0002

CON

0016

CON

0003

LDA

$0000

0017

LD

2206

0004

CON

0018

LDA

TM30

0005

STA

2200

0019

CON

0006

CON

0020

SUB

TM02

0007

STA

DM0000

0021

CON

0008

LD

2002

0022

STA

DM0000

0009

CTH

1 2200

0023

CON

0010

END

0024

KEEP

2206

0011

INT

0003

0025

RETI

0012

LDB

2206

0026

ENDH

0013

LDA

TM30

KVNKA Chap 06.p65

08.3.11, 0:10 PM

273

Advertising