TIMER A
7902 Group User’s Manual
9-22
9.4 Event counter mode
9.4.3 Switching between countup and countdown
Figure 9.4.5 shows structure of the up-down register.
The up-down register or the input signal from the TAiOUT pin is used to switch countup from and to
countdown. This switching is performed by the up-down bit when the up-down switching factor select bit
(bit 4 at addresses 5616 to 5A16) is “0,” and by the input signal from the TAiOUT pin when the up-down
switching factor select bit is “1.”
When the switching between countup and countdown is set while counting is in progress, this switching is
actually performed when the count source’s next valid edge is input.
(1)
Switching by up-down bit
Countdown is performed when the up-down bit is “0,” and countup is performed when the up-down
bit is “1.” Figure 9.4.5 shows the structure of the up-down register.
(2)
Switching by TAiOUT pin’s input signal
Countdown is performed when the TAiOUT pin’s input signal is at “L” level, and countup is performed
when the TAiOUT pin’s input signal is at “H” level.
When using the TAiOUT pin’s input signal to switch countup from and to countdown, set the port P5
and port P6 direction registers’ bits which correspond to the TAiOUT pin for the input mode.
Fig. 9.4.5 Structure of up-down register
b7 b6 b5 b4 b3 b2 b1 b0
0
1
2
3
4
5
6
7
Up-down register (Address 4416)
Timer A0 up-down bit
Timer A1 up-down bit
Timer A2 up-down bit
Timer A3 up-down bit
Timer A4 up-down bit
Timer A2 two-phase pulse signal
processing select bit
Timer A3 two-phase pulse signal
processing select bit
Timer A4 two-phase pulse signal
processing select bit
0 : Countdown
1 : Countup
This function is valid when the contents of the up-
down register is selected as the up-down switching
factor.
0 : Two-phase pulse signal processing function disabled
1 : Two-phase pulse signal processing function enabled
When not using the two-phase pulse signal processing
function, clear the bit to “0.”
The value is “0” at reading.
0
RW
WO
(Note)
WO
(Note)
WO
(Note)
Note: Use the MOVM(MOVMB) or STA(STAB, STAD) instruction for writing to bits 5 to 7.
Bit name
Bit
Function
At reset
R/W