beautypg.com

Precautions, Sample program, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 350: Pulse frequency calculation methods

background image

2 Instructions

2-314

CP1E CPU Unit Instructions Reference Manual(W483)

Reading Pulse Output or High-speed Counter Frequency (C = 00

@3 hex)

If C is 00

@3 hex, PRV(881) reads the frequency being output from pulse output 0 or 1 or the frequency

being input to high-speed counter 0 and stores it in D and D+1.

0000 or 0001 hex (Reading the frequency of pulse output 0 or 1)

0000 0000 to 0001 86A0 hex (0 to 100,000)

0010 hex (Reading the frequency of high-speed counter 0)

Counter input method: Any input method other than 4

× differential phase mode:

Result = 00000000 to 000186A0 hex (0 to 100,000)

Note If a frequency higher than 100 kHz has been input, the output will remain at the maximum value of 000186A0

hex.

Counter input method: 4

× differential phase mode:

Result = 00000000 to 00030D40 hex (0 to 200,000)

Note If a frequency higher than 200 kHz has been input, the output will remain at the maximum value of

00030D40 hex.

Pulse Frequency Calculation Methods

The function counts the number of pulses within a fixed interval (the sampling time) and calculates the
frequency from that count. One of the following three sampling times can be selected by setting the
rightmost two digits of C.

Precautions

If the counter is reset when P is 0010 hex (high-speed counter 0) and C is 0013, 0023, or 0033 hex
(sampling method), the data read during the sampling time when the counter was reset will not be
dependable.

Sample program

Sampling time

Value of C

Description

10 ms

0013 hex

Counts the number of pulses every 10 ms. The error is 10% max. at 1 kHz.

100 ms

0023 hex

Counts the number of pulses every 100 ms. The error is 1% max. at 1 kHz.

1 s

0033 hex

Counts the number of pulses every 1 s. The error is 0.1% max. at 1 kHz.

When CIO 0.00 turns ON in the following
programming example, CTBL(882) registers
a range comparison table for high-speed
counter 0 and starts comparison. When CIO
0.01 turns ON, PRV(881) reads the range
comparison results at that time and stores
them in CIO 0100.

When CIO 1.00 turns ON in the following
programming example, PRV(881) reads the
frequency of the pulse being input to high-
speed counter 0 at that time and stores it as
a hexadecimal value in D200 and D201.

@CTBL

#0000

#0001

D100

0.00

@PRV

#0010

#0002

100

0.01

Range comparison table
registration and comparison start

High-speed counter input 0

High-speed counter input 0

Read range comparison results

PRV

#0010

#0013

D200

1.00

Read input frequency

High-speed counter input 0

This manual is related to the following products: