evive has a real time clock attached to its IIC bus at 0x51 which can be ‘used to provide accurate date and time.
A real-time clock (RTC) is a computer clock (most often in the form of an integrated circuit) that keeps track of the current time. The term real-time clock is used to avoid confusion with ordinary hardware clocks which are only signals that govern digital electronics and do not count time in human units. (Wikipedia)
evive has an inbuilt RTC IC, PCF8563. The IC gets power from the internal battery of evive, so it can continue to keep time while the external source of power is off or unavailable.
The PCF8563 is a CMOS Real-Time Clock and calendar optimized for low power consumption. A programmable clock output, interrupt output, and a voltage-low detector is also provided. All addresses and data are transferred serially via a two-line bidirectional IIC-bus. Maximum bus speed is 400 kbit/s. The register address is incremented automatically after each written or read data byte.
It provides year, month, day, weekday, hours, minutes, and seconds based on a 32.768 kHz quartz crystal. It also has century flag, alarm and timer functions, integrated oscillator capacitor and internal Power-On Reset.
evive communicates with RTC via IIC-bus using wire.h library. Any data that comes in or comes out of RTC is in Binary-Coded Decimal (BCD) of eight bits. Given below is sample code demonstrating how to read and write on RTC.
We will use evive.h library directly which have direct access to RTC. and RTC.h can be downloaded from here