6 - 2 6 - 2
MELSEC-Q
6 CONVENIENT USAGE
6.1.1 Reading the counter function selection count value
The counter function selection count values are stored when the counter function
selection is executed. The count values when the latch counter, sampling counter and
periodic pulse counter functions are executed are stored in the counter function
selection count value storage buffer memory at the addresses shown in the table
below.
Counter function selection count value
Contents
Present
value
Latch count
value
Sampling
count value
Periodic pulse
count previous
value
Periodic pulse
count present
value
CH1 2H to 3H CH to DH EH to FH 10H to 11H 12H to 13H
Buffer
memory
address
CH2 22H to 23H 2CH to 2DH 2EH to 2FH 30H to 31H 32H to 33H
The present values and counter function selection count values are stored as 32-bit
signed binary values in the buffer memory. Also, since the contents of the buffer
memory are automatically updated by the count operation, the latest count values can
be read from the buffer memory.
POINT
(1) When reading the present and counter function selection count values, use the
DFRO command and always read values in two-word units. When reading
values in one-word units, if the count values are updated in the middle of read
processing, a mismatch may occur between the data contents of the lower and
higher words, possibly causing the system to read incorrect count values.
[Program example]
H00 H0E D0 K1
X20
DFRO
[Example of an undesirable program]
H00 H0F D1 K1
H00 H0E D0
K1
X20
FROM
FROM
(2) Although the latch count value and present periodic pulse count value are
stored in different addresses, the same values are always stored (updated at
the same time). Thus, when the latch counter function or periodic pulse
counter function is executed, the present periodic pulse count value and latch
count value do not retain their previous values.
6