PCF2129 RTC example code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PCF2129 RTC example code

PCF2129 RTC example code

**************************************************************************************************
* The PCF2129AT is a CMOS Real Time Clock (RTC) and calendar with an integrated
* Temperature Compensated Crystal Oscillator and a 32.768 kHz quartz crystal
* optimized for very high accuracy and very low power consumption.

*

* This simple example code has been written for the FRDM-KL25Z + OM13513
* boards and demonstrates how to set and read the time/date on the PCF2129AT
* using the SPI (do not forget to remove the JP1 jumper) interface. It also
* illustrates how to use a second interrupt to generate an interrupt on the
* INT pin once per second when the Seconds register increments.
*
* In this example the time to be set is Wednesday, February 26 2020, 10:30 AM.
*
* Connection:      FRDM-KL25Z           OM13513
* VDD                 J9-4                           P2-2
* GND                 J9-14                         P2-1
* MOSI               J2-8                            P2-5
* MISO               J2-10                          P2-6
* SCLK               J2-12                          P2-4
* CS                   J2-6                            P2-7
* INT                  J1-6                            P2-8
**************************************************************************************************

Enabling the second interrupt by writing 0x01 to the Control_1 register (0x00):

Second Interrupt Write.JPG

Second interrupt generated on the INT pin once per second:

Interrupt.JPG

Setting the time and date by writing to registers Seconds (0x03) - Years (0x09): 

Write.JPG

Actual time and date shown in the Debug window:

Capture.JPG

Attachments
Comments

Hi, is there any driver or example code for PCF2131?

No ratings
Version history
Last update:
‎02-27-2020 02:47 AM
Updated by: