English
Language : 

PIC18F47J53 Datasheet, PDF (252/586 Pages) Microchip Technology – 28/44-Pin, High-Performance USB Microcontrollers with nanoWatt XLP Technology
PIC18F47J53 FAMILY
TABLE 17-3: RTCVALH AND RTCVALL
REGISTER MAPPING
RTCC Value Register Window
RTCPTR<1:0>
RTCVAL<15:8> RTCVAL<7:0>
00
MINUTES
SECONDS
01
WEEKDAY
HOURS
10
MONTH
DAY
11
—
YEAR
The Alarm Value register window (ALRMVALH and
ALRMVALL) uses the ALRMPTR bits (ALRMCFG<1:0>)
to select the desired Alarm register pair.
By reading or writing to the ALRMVALH register, the
Alarm Pointer value, ALRMPTR<1:0>, decrements
by 1 until it reaches ‘00’. Once it reaches ‘00’, the
ALRMMIN and ALRMSEC value will be accessible
through ALRMVALH and ALRMVALL until the pointer
value is manually changed.
TABLE 17-4: ALRMVAL REGISTER
MAPPING
Alarm Value Register Window
ALRMPTR<1:0>
ALRMVAL<15:8> ALRMVAL<7:0>
00
ALRMMIN
ALRMSEC
01
ALRMWD
ALRMHR
10
ALRMMNTH
ALRMDAY
11
—
—
17.2.9 CALIBRATION
The real-time crystal input can be calibrated using the
periodic auto-adjust feature. When properly calibrated,
the RTCC can provide an error of less than three
seconds per month.
To perform this calibration, find the number of error
clock pulses and store the value in the lower half of the
RTCCAL register. The 8-bit, signed value, loaded into
RTCCAL, is multiplied by four and will either be added
or subtracted from the RTCC timer, once every minute.
To calibrate the RTCC module:
1. Use another timer resource on the device to find
the error of the 32.768 kHz crystal.
2. Convert the number of error clock pulses per
minute (see Equation 17-1).
EQUATION 17-1: CONVERTING ERROR
CLOCK PULSES
(Ideal Frequency (32,768) – Measured Frequency) *
60 = Error Clocks per Minute
• If the oscillator is faster than ideal (negative
result from step 2), the RTCCFG register value
needs to be negative. This causes the specified
number of clock pulses to be subtracted from
the timer counter, once every minute.
• If the oscillator is slower than ideal (positive
result from step 2), the RTCCFG register value
needs to be positive. This causes the specified
number of clock pulses to be added to the timer
counter, once every minute.
3. Load the RTCCAL register with the correct
value.
Writes to the RTCCAL register should occur only when
the timer is turned off, or immediately after the rising
edge of the seconds pulse.
Note:
In determining the crystal’s error value, it
is the user’s responsibility to include the
crystal’s initial error from drift due to
temperature or crystal aging.
DS39964B-page 252
Preliminary
 2010 Microchip Technology Inc.