A real-time clock (RTC) is a clock IC that keeps track of current time and date. It is used in making of computer clocks, digital clocks, attendance systems etc. 

evive has an inbuilt RTC IC, PCF8563. The IC gets power from the internal battery of evive, so it can continue to update time while the external source of power is off or unavailable. 


The PCF8563 is a CMOS logic based Real-Time Clock and Calendar optimized for low power consumption. For the RTC available on evive we can set the starting date and time on it. The RTC IC is communicates with evive on I2C protocol(Two Wire Communication) .

It consists of a 32.768 kHz quartz crystal  that provides year, month, day, weekday, hours, minutes, and seconds. It also has a century flag, alarm and timer functions, integrated oscillator capacitor, and internal Power-On Reset.

Read/Write operations on RTC with evive

evive communicates with RTC via IIC-bus. Below is a list of few read write functions used for RTC  present in evive.h library:

initclock()Clears all the RTC registers.
setDate(day,weekDay,month,century,year);Used to set date on RTC. Numeric entries corresponding to day, weekDay,month,century,year are to be given.
setTime(h,m,s)Set the current hour,minutes,seconds for setting start time of RTC.
formatDate(byte style)This function returns date in mm/dd/yyyy or dd-mm-yyyy or yyyy-mm-dd format depending upon hex value of style variable written in it.
formatTime(byte style)Gives time in HH:MM or HH:MM:SS format depending on hex value of style variable written in it.
getWeekDay()returns a number depending upon which day of the week it is. For example this function will return 6 for Saturday.


Below is a sample Arduino IDE sketch demonstrating how to write and read time on RTC:

This Helped
This didn't help
Close Menu


STEMpedia Starter Package is now on Indiegogo!
Get 41% OFF with Super Early Bird discounts!