Download Print this page

Epson S1C31D50 Technical Instructions page 125

Cmos 32-bit single chip microcontroller
Hide thumbs Also See for S1C31D50:

Advertisement

10.4. Operations
10.4.1. RTCA Control
Follow the sequences shown below to set time to RTCA, to read the current time and to set alarm.
Time setting
1. Set RTCA to 12H or 24H mode using the RTCACTLL.RTC24H bit.
2. Write 1 to the RTCACTLL.RTCRUN bit to enable for the real-time clock counter to start counting
up.
3. Check to see if the RTCACTLL.RTCBSY bit = 0 that indicates the counter is ready to rewrite. If the
RTCACTLL.RTCBSY bit = 1, wait until it is set to 0.
4. Write the current date and time in BCD code to the control bits listed below.
RTCASEC.RTCSH[2:0]/RTCSL[3:0] bits (second) RTCAHUR.RTCMIH[2:0]/RTCMIL[3:0] bits (minute)
RTCAHUR.RTCHH[1:0]/RTCHL[3:0] bits (hour)
RTCAHUR.RTCAP
RTCAMON.RTCDH[1:0]/RTCDL[3:0] bits (day) RTCAMON.RTCMOH/RTCMOL[3:0] bits (month)
RTCAYAR.RTCYH[3:0]/RTCYL[3:0] bits (year)
RTCAYAR.RTCWK[2:0] bits (day of the week)
5. Write 1 to the RTCACTLL.RTCADJ bit (execute 30-second correction) using a time signal to adjust
the time. (For more information on the 30-second correction, refer to "Real-Time Clock Counter
Operations.")
6. Write 1 to the real-time clock counter interrupt flags in the RTCAINTF register to clear them.
7. Write 1 to the interrupt enable bits in the RTCAINTE register to enable real-time clock counter
interrupts.
Time read
1. Check to see if the RTCACTLL.RTCBSY bit = 0. If the RTCACTLL.RTCBSY bit = 1, wait until it is set to
0.
2. Write 1 to the RTCACTLL.RTCHLD bit to suspend count-up operation of the real-time clock
counter.
3. Read the date and time from the control bits listed in "Time setting, Step 4" above.
4. Write 0 to the RTCACTLL.RTCHLD bit to resume count-up operation of the real-time clock
counter. If a second count-up timing has occurred in the count hold state, the hardware
corrects the second counter for +1 second (for more information on the +1 second correction,
refer to "Real-Time Clock Counter Operations").
Alarm setting
1. Write 0 to the RTCAINTE.ALARMIE bit to 0 to disable alarm interrupts.
2. Write the alarm time in BCD code to the control bits listed below (a time within 24 hours from the
current time can be specified).
RTCAALM1.RTCSHA[2:0]/RTCSLA[3:0] bits
RTCAALM2.RTCMIHA[2:0]/RTCMILA[3:0] bits
RTCAALM2.RTCHHA[1:0]/RTCHLA[3:0] bits
RTCAALM2.RTCAPA bit (AM/PM) (effective when RTCACTLL.RTC24H bit = 0)
3. Write 1 to the RTCAINTF.ALARMIF bit to clear the alarm interrupt flag.
4. Write 1 to the RTCAINTE.ALARMIE bit to enable alarm interrupts.
When the real-time clock counter reaches the alarm time set in Step 2, an alarm interrupt occurs.
10-4
bit
(AM/PM)
(effective
Seiko Epson Corporation
when
RTCACTLL.RTC24H
(second)
(minute)
(hour)
S1C31D50 TECHNICAL MANUAL
bit
=
0)
(Rev. 1.00)

Advertisement

loading