Initialization and setting of alarm and timer, 1 initialization of the rtc and setting the time, Nxp semiconductors – NXP Semiconductors UM10301 PCF2123 User Manual
Page 26
NXP Semiconductors
UM10301
User Manual PCF85x3, PCA8565 and PCF2123, PCA2125
UM10301_1
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 01 — 23 December 2008
26 of 52
12. Initialization and setting of alarm and timer
Setting the clock is a straightforward procedure, setting first the mode and then the actual
time. This example is for the PCF8563 and for reference its block diagram is given in
Fig 10 which shows the registers and their addresses. The procedure for the other RTCs
is similar but there are small differences in register structure and therefore the
appropriate datasheet should be consulted first.
001aah658
PCF8563
OSCILLATOR
32.768 kHz
DIVIDER
CLOCK OUT
INTERRUPT
CLKOUT
INT
MONITOR
POWER ON
RESET
WATCH
DOG
I
2
C-BUS
INTERFACE
OSCI
SCL
SDA
OSCO
V
DD
V
SS
TIMER FUNCTION
TIMER_CONTROL
0E
TIMER
0F
CONTROL
CONTROL_STATUS_1
00
CONTROL_STATUS_2
01
CLKOUT_CONTROL
0D
TIME
VL_SECONDS
02
MINUTES
03
HOURS
04
DAYS
05
ALARM FUNCTION
MINUTE_ALARM
09
HOUR_ALARM
0A
DAY_ALARM
0B
WEEKDAY_ALARM
0C
WEEKDAYS
06
CENTURY_MONTHS
07
YEARS
08
Fig 10. Block Diagram PCF8563
Examples for initialisation and setting of time, alarm and timer are given below.
12.1 Initialization of the RTC and setting the time
Table 5 on the next page shows the sequence of commands to be sent to the RTC for
initialization and setting the time.
In this example the time to be set is Friday, July 16 2008, 2:45 pm.