289
UDCNT2
1
2
3
4
6
7
8
6.8
O
ther Con
venient Instru
ctions
6.8.2
UDCN
T2
:
+ 0: Input number for count input (A phase pulse) (bits)
+ 1: Input number for count input (B phase pulse) (bits)
: Number of the counter to be enabled to start counting with the UDCNT2 instruction (Device name)
n
: Value to set (BIN 16 bits)
*1:
Only the X device can be used for . However, the X device can be used only in the range of number of I/O points
(the number of accessible points to actual I/O modules).
*2:
Local devices and the file registers set for individual programs cannot be used.
Function
(1) The present value of the counter designated by is updated depending on the status of the input designated by (A
phase pulse) and the status of the input designated by +1 (B phase pulse).
(2) Direction of the count is determined in the following manner:
• When is ON, if +1 goes from OFF to ON, count up operation is performed (values are added to the present value
of the counter).
• When is ON, if +1 goes from ON to OFF, count down operation is performed (values are subtracted from the
present value of the counter).
• No count operation is performed if is OFF.
(3) Count processing is conducted as described below:
• When the count is going up, the counter contact designated at goes ON when the present value becomes identical
with the setting value designated by n. However, the present value count will continue even when the contact of the
counter designated at goes ON. (See Program Example (1))
• When the count is going down, the counter for the contact designated at goes OFF when the present value
reaches the set value -1. (See Program Example (1))
• The counter designated at is a ring counter. If it is counting up when the present value is 32767, the present value
will become -32768. Further, if it is counting down when the present value is -32768, the present value will become
32767. The count processing performed on the present value is as shown below:
(4) Count processing conducted according to the UDCNT2 instruction begins when the count command goes from OFF to
ON, and is suspended when it goes from ON to OFF.
When the execution command is turned OFF to ON again, the counting resumes from the suspended value.
(5) The RST instruction clears the present value of the counter designated at and turns the contact OFF.
UDCNT2
Counter 2-phase input up or down
6.8.2
UDCNT2
Setting
Data
Internal Devices
R, ZR
J \
U \G
Zn
Constants
K, H
Other
Bit
Word
Bit
Word
(Only X)
*1
––
––
––
––
––
(Only C)
*2
––
––
––
n
*2
*2
*2
––
Basic
Redundant
Process
High
performance
Universal
LCPU
Command
U
DCNT2
n
UDCNT2
S
D
S
S
S
D
S
D
S
D
S
S
S
S
S
S
S
D
D
D
D
32768
32767
2
1
0
1
2
32767
32766
W
hen counting down
W
hen counting up
D