RTC PCF8523 evaluation board OM13511
6. Software
The actual time must be set after power-on. For this, straightforward I
2
C-bus instructions
are used.
6.1 Functionality
The RTC PCF8523 is controlled via standard I
2
C-bus interface. Common I
2
C protocol
applies. The interface features the Fast Mode+ I
2
C-bus, operating up to 1 MHz. There is
theoretically no lower speed limit, however the access of the RTC should be completed
within less than 1 second, otherwise time counter-increments could be lost. During
access, the time registers of the RTC are frozen and after the read or write, sequence is
completed, a second’s increment is executed if necessary.
The clock tracks the actual time from seconds to year. It must initially be set to the
correct time. The days per month and leap year are corrected automatically.
The RTC can be programmed to generate an interrupt every 30 seconds or every
60 seconds.
A general-purpose RAM byte to store temporary information is at address 03h.
6.2 Software instructions for setting the clock
6.2.1 Setting the time
Setting the clock to 3.45 PM, December 15, 2015:
• I
2
C-bus START condition
• Slave address D0h, i.e. write bit set to 0
• Register address 00h: address pointer to register Control_1
• Register Control_1, 08h: set 12-hour mode and selects option for 7 pF quartz crystal
• Register Control_2, 00h: no timers or watch dog initiated
• Register Control_1, 88h: activate interrupt to monitor battery switch-over
Setting the actual time and date
• Register Seconds, 00h: 0 Seconds (clock integrity ok, MSB OS = 0)
• Register Minutes, 45h: 45 min
• Register Hours, 23h: PM, 3 hours
• Register Days, 15h: 15
th
day of the month
• Register Weekdays, 02h: Tuesday (second day of the week)
• Register Months, 12h: December
• Register Years, 15h: (20)15
• I
2
C-bus STOP condition
UM10760 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2015. All rights reserved.
User manual Rev. 1 — 2 February 2015 8 of 13