BAT32G1x9 user manual | Chapter 8 Timer B
289 / 1149
Rev.1.02
8.4.5 Phase count mode
The phase count mode detects the phase difference between the external input signals of the two TBBCLK0 pins
and the TBKK1 pin, and the TB registers increment/decrement count.
When the PM xx bit of the PM register is "1", if set to phase count mode, the TBCLK0 pin and the TBBCLK1 pin
are automatically used as external clock input pins, and Tb registers are added and subtracted according to the setting
of CNTEN0 to CNTEN7 bits of the TBCNTC registers, and the TB REGISTER is counted The settings of
TBTCK0~TBTCK2 bit, TBCKEG0 bit, and TBCKEG 1 bit are not related. However, because the TBCCR registers
TBCCLR bits 0 and TBCCLR 1 bits, TBIOR, TBIER, TBIR, TBIER The TBSR, TBGRA, TBGRB registers are valid, so
the input capture/output comparison function, PWM output function, and interrupt source can be used.
Depending on the setting of CNTEN0 to CNTEN7 bits, the TB registers are counted on the bilateral edge of the
rising/falling edge of the TBCLK0 pin and the TBCLK1 pin.
The specifications of the phase count mode and the conditions for adding and subtracting TB registers are
shown in Table 8-14 and Table 8-15, respectively.
Table 8-14 Specifications of Phase Count Mode
Item
specification
Count the sources
External input signal from the TBCLK0/TBCLK1 pins
count
Increment/decrement count
Count start criteria
Write "1" (start counting) to the TBSTART bit of the TBBR register.
Count stop conditions
Write "0" (stop count) to the TBSTART bit of the TBMR register.
Timing of the generation of
interrupt requests
•Input capture (effective edges of TBIO0/TBIO1 input).
• Comparison matching (TB registers and TBGRA/TBGRB registers have the same
content).
• Overflow of TB registers
• Underflow of TB registers
TBIO0 pin function
I/O port, input capture input, output comparison output, or PWM output
TBIO1 pin function
I/O ports, inputs that are captured, or outputs that are compared
TBCLK0 pin and
Features of the TBCLK1
pin
External clock input
Read timer
If you read the TB register, you can read the count value.
Write timer
Can write TB registers.
Select Features
• Selection of counters for addition and subtraction conditions
Selection is made by CNTEN0~CNTEN7 bits of the TBCNTC register.
• Can use input capture/output comparison function and PWM function.
Table 8-15 TB register addition and subtraction conditions
TBCLK1 pin
"H"
"L"
"H"
"L"
TBCLK0 pin
"L"
"H"
"L"
"H"
TBCNTC registers
CNTEN0~CNTEN7
bit
CNTEN7
CNTEN6
CNTEN5
CNTEN4
CNTEN3
CNTEN2
CNTEN1
CNTEN0
Count the directional note
+1
+1
+1
+1
–1
–1
–1
–1
Note indicates the count direction of the TBCNTC
register when the number is
"1"
(incrementing or decreasing count).
Is
not counted when
"0"
(invalid).