Microchip Technology ARD00385 Data Sheet

Page of 570
PIC18F87K90 FAMILY
DS39957D-page 230
 2009-2011 Microchip Technology Inc.
17.2.2
CLOCK SOURCE
As previously mentioned, the RTCC module is intended
to be clocked by an external Real-Time Clock (RTC)
crystal oscillating at 32.768 kHz, but an internal oscillator
can be used. The RTCC clock selection is decided by
the RTCOSC bit (CONFIG3L<0>).
Calibration of the crystal can be done through this
module to yield an error of 3 seconds or less per month.
(For further details, see 
.)
FIGURE 17-4:
CLOCK SOURCE MULTIPLEXING 
17.2.2.1
Real-Time Clock Enable
The RTCC module can be clocked by an external
32.768 kHz crystal (SOSC oscillator), or the LF-INTOSC
oscillator, which can be selected in CONFIG3L<0>.
If the external clock is used, the SOSC oscillator should
be enabled via the SOSCGO bit (OSCCON2<3>). If
LF-INTOSC is providing the clock, the INTOSC clock
can be brought out to the RTCC pin by the RTSEC-
SEL<1:0> bits (PADCFG<2:1>).
17.2.3
DIGIT CARRY RULES
This section explains which timer values are affected
when there is a rollover:
• Time of Day: From 23:59:59 to 00:00:00 with a 
carry to the Day field
• Month: From 12/31 to 01/01 with a carry to the 
Year field
• Day of Week: From 6 to 0 with no carry (see 
)
• Year Carry: From 99 to 00; this also surpasses the 
use of the RTCC
For the day-to-month rollover schedule, see 
Because the following values are in BCD format, the
carry to the upper BCD digit occurs at the count of 10,
not 16 (SECONDS, MINUTES, HOURS, WEEKDAY,
DAYS and MONTHS).
TABLE 17-1:
DAY OF WEEK SCHEDULE
TABLE 17-2:
DAY-TO-MONTH ROLLOVER 
SCHEDULE
Note
1:
Writing to the lower half of the MINSEC register resets all counters, allowing fraction of a second 
synchronization; clock prescaler is held in Reset when RTCEN  = 0.
32.768 kHz XTAL
1:16384
Half Second
(1)
Half Second
Clock
One Second Clock
Year
Month
Day
Day of Week
Second
Hour:Minute
Clock Prescaler
(1)
from SOSC
Internal RC
CONFIG3L<0>
Day of Week
Sunday
0
Monday
1
Tuesday
2
Wednesday
3
Thursday
4
Friday
5
Saturday
6
Month
Maximum Day Field
01 (January)
31
02 (February)
28 or 29
(
)
03 (March)
31
04 (April)
30
05 (May)
31
06 (June)
30
07 (July)
31
08 (August)
31
09 (September)
30
10 (October)
31
11 (November)
30
12 (December)
31
Note 1:
See