![](http://datasheet.mmic.net.cn/30000/M38223E4-XXXHP_datasheet_2360327/M38223E4-XXXHP_120.png)
APPLICATION
2.3 Timer X and timer Y
3822 GROUP USER’S MANUAL
2–54
(3) Timer Y latch and timer Y counter (corresponding to timer Y (low-order) and timer Y (high-
order))
The timer Y latch (referred as “the Y latch”) and the timer Y counter (referred as “the Y counter”)
consist of 16 bits in a combination of high-order and low-order.
The Y latch and Y counter are allocated at the same address. To access the Y latch and the Y
counter, access both the timer Y (low-order) and the timer Y (high-order).
sRead
When the timer Y (high-order and low-order) are read out, the value of the Y counter (count value)
are read out. Read both registers in the order of the timer Y (high-order) and the timer Y (low-order).
Do not write any value to the timer Y (high-order and low-order) before the timer Y (low-order) has
been read out. In this case, timer Y will not operate normally.
sWrite
When a value is written to the timer Y (low-order and high-order), the value is set in the Y latch and
the Y counter at the same time. Write the values to both registers in the order of the timer Y (low-
order) and the timer Y (high-order).
Do not read the timer Y (low-order and high-order) before the timer Y (high-order) has been written.
In this case, timer Y will not operate normally.
qTimer Y latch
The Y latch is a register which holds the value to be transferred (reloaded) automatically to the Y
latch as the initial value of the Y counter at the Y counter underflow. Figure 2.3.14 shows the
structure of the timer Y latch.
Reload is performed at the following :
At the Y counter underflow
At the edge of the input pulse from the P55/CNTR1 pin
(period measurement mode/pulse width HL coutinuously measurement mode)
The contents of the Y latch cannot be read out.
Fig. 2.3.14 Structure of timer Y latch
Note : Write both registers in the order of TYL and TYH.
b7 b6 b5 b4 b3 b2 b1 b0
Timer Y (high-order, low-order) (TYH, TYL) [Address 23 16, 2216]
B
Functions
At reset R W
Timer Y (high-order, low-order)
0
to
7
Set “000016 to FFFF16” as timer Y count value.
Write high-order byte of setting value to TYH,
and low-order byte to TYL, respectively.
The values of TYH and TYL are set to the
respective Y latches and transferred auto-
matically to the respective Y counters at the
Y counter underflow.
1
qTimer Y latch
×