
417
18.3.2
Reload Timer Operation
When the TMB TMB22* bit is 0 and furthermore the TMB1 TMB13 bit is 1, timer B operates as
an 8-bit reload timer. When a reload value is loaded into the TWBL/U pair, that value is loaded
into TCB and timer B begins to count up from that value.
On the clock input after the count value in TCB reaches $FF, timer B overflows, the value in the
TWBL/U pair is loaded into TCB, and timer B continues counting from that value. This means
that the timer B overflow period can be set to be any value in the range 1 to 256 times the input
clock period.
The operating clock and interrupt operation during reload timer operation are identical to those for
free-running timer operation.
When a new reload value is loaded into the TWBL/U pair that value is immediately written to
TCB.
Note: * Applies to the HD404318, HD404358, HD404358R, HD404339, and HD404369 Series.
The TMB22 bit is unused in the HD404344R and HD404394 Series.
18.3.3
External Event Counter Operation
When the TMB1 TMB12 to TMB10 bits are set to 111, TCB is incremented by the EVNB pin
input signal edges specified by the TMB21 and TMB20 bits.
Other aspects of timer B operation in this mode are identical to either free-running or reload timer
operation depending on the setting of the TMB1 TMB13 bit.
18.3.4
Input Capture Timer Operation
HD404318/HD404358/HD404358R/HD404339/HD404369 Series
The input capture timer function measures the period between EVNB input pin edge detection
events. An internal clock must be selected as the TCB operating clock when timer B is used as an
input capture timer.
Timer B operates as an input capture timer when the TMB2 TMB22 bit is set to 1. TCB will be
cleared to $00 at that point.
The TMB2 TMB21 and TMB20 bits select the edge detection event type, which can be either a
falling edge, a rising edge, or a falling/rising edge pair on the EVNB input pin.
When an edge is detected on the EVNB pin, the value of TCB at that time is written to the
TRBL/U pair and IFTB and ICSF are both set to 1. At the same time TCB is cleared to $00 and
continues to count up from $00.
ICEF is set to 1 if the next edge is detected when ICSF is set to 1 or if TCB overflows.