Real Time Clock

Real Time Clock

Real Time Clock

June 2, 2017

Introduction

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.

PCF8563

The PCF8563 is a CMOS Real-Time Clock and calendar optimized for low power consumption. A programmable clock output, interrupt output, and a low voltage 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 the 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.

Read/Write on RTC in Arduino IDE

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.

Example

Given below is sample code demonstrating how to read and write on RTC.

evive Notes Icon
Note: setPCF8563(); function is used to initialize the clock to a given time. So, to reset the time un-comment setPCF8563();, change the time and date, and upload to the evive. 
We are using evive.h library to run the program. You can download it from here.

RTC on Scratch

In evive Inbuilt Extension, there are blocks for the following purposes:

You can use these block in Scratch and Arduino Mode. 

Example

Here are some example scripts showing how to use the above blocks:

  • In this program we set the time on the clock to the present time and then we display it on evive’s TFT.

Scratch Real Time Clock Set time

  • In this program we set the date on the clock to the present date and then we display it on evive’s TFT.

Scratch Display Date

 

Share this Page
Facebook
Twitter
Google+
Pinterest
Reddit
Print
Related Tutorials
Featured Projects
Drip Irrigation System
Intermediate
Chetan
Drip Irrigation System

Introduction Drip irrigation system is a type of micro-irrigation of soil which has the potential to save water and nutrients by allowing water to drip slowly to the roots of

Explore this Project

Leave a Reply

Leave a Reply

Close Menu
×

Cart