R8C/38T-A Group
18. Timer RE2
Under development Preliminary document
Specifications in this document are tentative and subject to change.
R01UH0241EJ0010 Rev.0.10
Page 367 of 730
Aug 05, 2011
18.3.5
Alarm Function
Generation of an alarm can be set by minutes, hours, or days of the week, or any combination of these. Write 1
to an enable bit in the target alarm register and set the lower bits to the alarm time. Write 0 to an enable bit in the
other alarm registers.
When the counter and the alarm time match, the ALIF bit in the TREIFR register is set to 1 (interrupt
requested). Detection of the alarm can be confirmed by reading the ALIF bit, but usually confirmed by using an
interrupt. When 1 (alarm interrupt enabled) has been written to the ALIE bit, an alarm interrupt request is
generated and the alarm can be detected.
The ALIF bit that has changed to 1 is set to 0 by writing 0 by a program.
The following shows an alarm setting example:
Set bits AMN6 through AMN4 to 5 and bits AMN3 through AMN0 to 8 in the TREAMN register (58
minutes).
Set the APM bit to 0 (a.m.) and bits AHR5 through AHR0 to 3 (3 o’clock) in the TREAHR register.
Set bits AWK2 to AWK0 in the TREAWK register to 001b (Monday).
Table 18.6
Alarm Interrupt Request Generation Conditions
ENBWK Bit in
TREAWK Register
ENBHR Bit in
TREAHR Register
ENBMN Bit in
TREAMN Register
Alarm Interrupt Request Generation Condition
0
No alarm interrupt request is generated.
001
An alarm interrupt request is generated at 58
minutes and 00 seconds.
010
An alarm interrupt request is generated at
3:00:00 a.m.
011
An alarm interrupt request is generated at
3:58:00 a.m.
100
An alarm interrupt request is generated at
0:00:00 a.m. on Monday.
101
An alarm interrupt request is generated at 58
minutes and 00 seconds on Monday.
110
An alarm interrupt request is generated at
3:00:00 a.m. on Monday.
111
An alarm interrupt request is generated at
3:58:00 a.m. on Monday.