
418
When timer B is used as an input capture timer (when the TMB22 bit is 1) TRBL and TRBU can
be read in any order. (See figure 18-2.)
18.4
Interrupts
Timer B interrupts are generated on TCB overflow and on EVNB pin edge detections during input
capture timer operation*.
When an interrupt is generated, IFTB in the interrupt control bit area is set to 1.
Timer B in the HD404344R and HD404394 Series does not support the input capture function.
IFTB is never cleared automatically, even if the interrupt is accepted. The interrupt handling
routine should clear IFTB to 0.
The timer B interrupt can be independently enabled or disabled by IMTB in the interrupt control
bit area.
Note: * Applies to the HD404318, HD404358, HD404358R, HD404339, and HD404369 Series.
Timer B in the HD404344R and HD404394 Series does not support the input capture
function.
18.5
Usage Notes
Keep the following points in mind when using timer B.
Be sure to write TWBL first and then TWBU when using the TWBL/U pair to set the TCB
reload value or to initialize TCB. The value in the TWBL/U pair is written to TCB at the point
that TWBU is written. Thus if TWBL has been set and only the value in the upper digit is to be
changed, it is only necessary to write TWBU.
Be sure to read TRBU first and then TRBL when reading the TCB value using the TRBL/U
pair. The value in the lower digit of TCB is latched into TRBL when TRBU is read. Thus
reading TRBL returns the value of the TCB lower digit at the point TRBU was last read.
However, the TRBL/U pair can be read in any order during input capture timer operation.
When changing the value of TMB1, the new value becomes valid two instructions after the
execution of the instruction that wrote TMB1. Therefore it is necessary for programs that
initialize timer B (set the reload value or initialize TCB) by writing to the TWBL/U pair to
perform this initialization only after the mode changed by TMB1 has become valid.
When detection of falling/rising edge pairs on the EVNB pin is selected by the TMB2 setting,
the falling edge and the rising edge must be separated by at least 2t
cyc.