
CHAPTER 11 INTERVAL TIMER, WATCH TIMER
Preliminary User’s Manual U16895EJ1V0UD
365
11.1.4 Operation
(1) Operation of interval timer BRG
Set the count clock by using the PRSM.BGCS1 and PRSM.BGCS0 bits 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
m
× N/fX
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)
fX:
Main clock oscillation frequency
(2) Count clock supply for watch timer
Set the count clock by using the PRSM.BGCS1 and PRSM.BGCS0 bits and the 8-bit compare value by using
the PRSCM register, so that the count clock frequency (fBRG) of the watch timer is 32.768 kHz. Clear (0) the
PRSM.TODIS bit at the same time.
When the PRSM.BGCE bit is set (1), fBRG is supplied to the watch timer.
fBRG is obtained from the following equation.
fBRG = fX/(2
m+ 1
× N)
To set fBRG to 32.768 kHz, perform the following calculation to set the BGCS1 and BGCS0 bits and the
PRSCM register.
<1>
Set N = fX/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 odd or m = 3
<4>
Set N to the PRSCM register and m to the BGCS1 and BGCS0 bits.
Example:
When fX = 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)
fX:
Main clock oscillation frequency