741
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
High-speed Counter/Pulse Output Instructions
3
PRV
• High-frequency Calculation Method: In this case, the counting method is switched at high and low
frequencies.
At high frequencies (above 1 kHz), 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 sam-
pling times can be selected by setting the rightmost two digits of C.
At frequencies below 1 kHz, the Standard Calculation Method is used, regardless of the sampling
time setting.
The update period for the frequency is the same as the sampling time. Following characteristics for
changes in the frequency will deteriorate as the sampling time increases.
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 for high frequency), the data read during the sampling time when the counter was
reset will not be dependable.
When this is performed for a CJ2M CPU Unit, the Carry Flag (P_CY) will turn ON when the PRV(881)
instruction is executed.
Example Programming
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
#0003
D200
1.00
Read input frequency
High-speed counter input 0