Visual kv series – KEYENCE Visual KV Series User Manual

Page 269

Advertising
background image

4.7 Examples of Direct Clock Pulse Output

3-245

Visual KV

Series

1

4

Chapter 4 High-speed Counters

2103

SET

2104

RES

2105

RES

2106

SET

2107

RES

2108

RES

2109

SET

2110

RES

2111

RES

CTH0

RES

2008

2002

#00050

CTC0

#00020

CTC1

CTH0

2101

0001

0002

0003

0004

0005

CTC0
CTC1

ON

ON

ON

ON

4.7.2

Example of Outputting a Pulse with Variable ON/OFF
Ratio

To output a clock pulse of 500 µs (2 kHz)-period and 200 µs-width from output relay 0500

This section describes a programming example that will output a clock pulse with
variable ON/OFF ratio from output relay 0500 by using the high-speed counter
(CTH0) and high-speed counter comparator (CTC0 and CTC1).

Special utility relay setting
Set the special utility relay (2103 through 2112) according to the following table.

Internal clock and CTC0/CTC1 preset values
Specify the internal clock and calculate the preset values of CTC0 and CTC1 for the
clock.

CTC1 preset value = Pulse width (µs) ÷ Internal clock (µs)
CTC0 preset value = Pulse period (µs) ÷ Internal clock (µs)

Obtain the preset values of CTC0 and CTC1 by substituting 200 µs for the pulse
width, 500 µs for the pulse period, and 10 µs for the internal clock (special utility
relay 2101).
In this case, the preset value of CTC1 is "20", and that of CTC0 is "50".
Refer to the following table for the CTC preset values with other internal clocks.

Example

Count value

Sets the pulse output from output relay 0500 with special utility relays 2104 through 2107
and 2108 through 2111.
In this example, turns OFF 2104 to enable direct output from 0500. Turns ON 2106 to turn
ON the output from 0500 when the CTH0 value reaches the CTC0 value, and turns ON
2109 to turn OFF the output when the CTH0 value reaches the CTC1 value.

Turns ON 2103 to set CTH0 to be cleared when its value reaches the CTC0 value. This
ensures that the first clock pulse is output at the proper pulse width.

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

.

o

N

y

a

l

e

R

g

n

i

t

t

e

S

.

o

N

y

a

l

e

R

g

n

i

t

t

e

S

3

0

1

2

N

O

8

0

1

2

F

F

O

4

0

1

2

F

F

O

9

0

1

2

N

O

5

0

1

2

F

F

O

0

1

1

2

F

F

O

6

0

1

2

N

O

1

1

1

2

F

F

O

7

0

1

2

F

F

O

2

1

1

2

F

F

O

y

a

l

e

r

y

t

i

l

i

t

u

l

a

i

c

e

p

S

k

c

o

l

c

l

a

n

r

e

t

n

I

e

u

l

a

v

t

e

s

e

r

p

0

C

T

C

e

u

l

a

v

t

e

s

e

r

p

1

C

T

C

0

0

1

2

0

.

1

µs

0

0

5

0

0

2

1

0

1

2

0

.

0

1

µs

0

5

0

2

2

0

1

2

0

.

0

0

1

µs

5

2

KVNKA Chap 04_2.p65

08.3.11, 0:08 PM

245

Advertising