beautypg.com

7 examples of direct clock pulse output, Visual kv series – KEYENCE Visual KV Series User Manual

Page 266

background image

4.7 Examples of Direct Clock Pulse Output

3-242

Visual KV

Series

4

Chapter 4 High-speed Counters

CTC0

ON

ON

4.7

Examples of Direct Clock Pulse Output

This section describes programming examples of the direct clock pulse output.

4.7.1

Example of Outputting a Pulse with 1:1 ON/OFF Ratio

To output a clock pulse of 1 ms (1 kHz)-period from output relay 0500

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

Special utility relay setting
Set the special utility relay (2103 through 2112) according to the following table.
When outputting a pulse with 1:1 ON/OFF ratio, you can simplify the program by
using the reverse (toggle) output (2107: ON).

Internal clock and CTC0 preset value
Specify the internal clock and calculate the preset value of CTC0 for the clock.

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

Obtain the preset value of CTC0 by substituting 1 ms for the pulse period and 10 µs
for the internal clock (special utility relay 2101).
In this case, the preset value of CTC0 is "50".
Refer to the following table for the preset value of CTC0 with other internal clocks.

Example

Count value

Sets the pulse output from output relay 0500 with special utility relays 2104 through 2107.
In this example, turns OFF 2104 to enable direct output from 0500 and turns ON 2107 to
reverse the output each time the CTH0 value reaches the CTC0 value.

Turns ON 2103 to set CTH0 to be cleared when its value reaches the CTC0 value.

With this setting, the operation which clears the CTH0 current value when it reaches the
CTC0 preset value is repeated.

The RES CTH0 instruction resets the CTH0 current value when operation starts. 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

3

0

1

2

N

O

4

0

1

2

F

F

O

5

0

1

2

F

F

O

6

0

1

2

F

F

O

7

0

1

2

N

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

0

0

1

2

0

.

1

µs

0

0

5

1

0

1

2

0

.

0

1

µs

0

5

2

0

1

2

0

.

0

0

1

µs

5

2103

SET

2104

RES

2105

RES

2106

RES

2107

SET

CTH0

RES

2008

2002

#00050

CTC0

CTH0

2101

0001

0002

0003

KVNKA Chap 04_2.p65

08.3.11, 0:08 PM

242