
214
CHAPTER 8 8/16-BIT TIMER/COUNTER
8.4.3
Timer 1 Data Register (T1DR)
The Timer 1 data register (T1DR) is used to set an interval timer value (in the interval
timer function mode) or a counter value (in the counter function mode) for Timer 1 in
the 8-bit mode or for the lower 8 bits in the 16-bit mode of the 8/16-bit timer/counter as
well as read the counter value.
I
Timer 1 Data Register (T1DR)
The value in this register is compared with the counter value. Reading this register reads the
current counter value. The value in this register cannot be read.
Figure 8.4-4 "Timer 1 Data Register (T1DR)" shows the bit configuration of the Timer 1 data
register.
Figure 8.4-4 Timer 1 Data Register (T1DR)
H
In the 8-bit mode (Timer 1)
The value in this register is compared with the counter value. This register is set to an interval
time value in the interval timer function mode or a count value to be detected in the counter
function mode. Enabling the count operation (T1CR: STR1=0 --> 1, STP1=0) sets (loads) the
T1DR register value in the comparator data latch and starts the count-up.
If the comparator data latch value and the counter value match due to the count-up, the T1DR
register value is reset in the comparator data latch, the counter is cleared, and the count
operation is continued.
The comparator data latch is reset if a match is detected. Thus, a value written in the T1DR
register while the counter operates becomes valid in the next cycle (after a match is detected)
and thereafter.
You can calculate the value in the T1DR register in the interval timer mode as follows. Note that
the instruction cycle is influenced by the clock mode or the gear function.
T1DR register value = Interval time / (Count clock cycle x Instruction cycle) -1
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
001D
H
Address
XXXXXXXX
B
Initial value
R/W : Read/write enabled
X
: Undefined