CHAPTER 10 INTERVAL TIMER, WATCH TIMER
User’s Manual U16896EJ2V0UD
340
10.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 01H and counting is
continued.
The interval time can be obtained from the following equation.
Interval time = 2
m
×
N/f
X
Remark
m: Divided value (set value in the BGCS1 and BGCS0 bits) = 0 to 3
N: Set value in PRSCM register
Note
= 1 to 256 (when the set value in the PRSCM register is 00H,
N = 256)
f
X
: Main clock oscillation frequency
Note
The INTBRG interrupt is generated only once when the set value in the PRSCM register = 01H.
(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 (f
BRG
) 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), f
BRG
is supplied to the watch timer.
f
BRG
is obtained from the following equation.
f
BRG
= f
X
/(2
m+ 1
×
N)
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 odd 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
<R>
<R>
Содержание ?PD703302
Страница 2: ...User s Manual U16896EJ2V0UD 2 MEMO ...