![](http://datasheet.mmic.net.cn/370000/UPD703215_datasheet_16743812/UPD703215_386.png)
CHAPTER 11 INTERVAL TIMER, WATCH TIMER
User’s Manual U16890EJ1V0UD
386
11.1.4 Operation
(1) Operation of interval timer BRG
Set the count clock by using the BGCS1 and BGCS0 bits of PRSM and the 8-bit compare value by using the
PRSCM register.
When the PRSM.BGCE bit is set (1), interval timer BRG starts operating.
Each time the count value of the 8-bit counter and the set value in the PRSCM register match, an interrupt
request signal (INTBRG) is generated. At the same time, the 8-bit counter is cleared to 00H and counting is
continued.
The interval time can be obtained from the following equation.
Interval time = 2
Remark
m: Division value (set values of BGCS1 and BGCS0 bits) = 0 to 3
N: Set value in PRSCM register = 1 to 256 (when the set value in the PRSCM register is 00H,
N = 256)
f
X
: Main clock oscillation frequency
(2) Count clock supply for watch timer
Set the count clock by using the BGCS1 and BGCS0 bits of PRSM and the 8-bit compare value by using the
PRSCM register, so that the count clock frequency (f
BRG
) of the watch timer is 32.768 kHz. Set (1) the
PRSM.TODIS bit at the same time.
When the PRSM.BGCE bit is set (1), f
BRG
is supplied to the watch timer.
f
BRG
is obtained from the following equation.
f
BRG
= f
X
/(2
To set f
BRG
to 32.768 kHz, perform the following calculation to set the BGCS1 and BGCS0 bits and the
PRSCM register.
<1> Set N = f
X
/65,536 (round off the decimal) to set m = 0.
<2> If N is even, N = N/2 and m = m + 1
<3> Repeat step <2> until N is even or m = 3
<4> Set N to the PRSCM register and m to the BGCS1 and BGCS0 bits.
Example: When f
X
= 4.00 MHz
<1> N = 4,000,000/65,536 = 61 (round off the decimal), m = 0
<2>, <3> Since N is odd, the values remain as N = 61, m = 0
<4> The set value in the PRSCM register: 3DH (61), the set values in the BGCS1 and BGCS0
bits: 00
Remark
m: Divided value (set value in the BGCS1 and BGCS0 bits) = 0 to 3
N: Set value in PRSCM register = 1 to 256 (when the set value in the PRSCM
register is 00H, N = 256)
f
X
: Main clock oscillation frequency
m
×
N/f
X
m+ 1
×
N)