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 registered 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 a 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 PictoBlox (Scatch)

In evive extension, there are blocks for the following purposes:

  1. Setting the Time
    set clock to
  2. Setting the Date
    set date to
  3. Getting time from RTC
    get from clock

You can use these block in Stage Mode and Upload Mode

Example

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

  1. In this program, we set the time on the clock to the present time and then we display it on evive’s TFT.
    set time example
  2. In this program, we set the date on the clock to the present date and then we display it on evive’s TFT.
    set date example
Share this Documentation
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Tutorials & Projects

How to use evive’s Real-time Clock

This tutorial discusses what is a real-time clock, and how to use evive's real-time clock to show time, date, and day with the help of an Arduino IDE sketch.
get from clock

get () from clock

The block returns the value of “hours”, “minutes”, “seconds”, "date", "month", "year" or "weekday" from evive’s RTC. 
All articles loaded
No more articles to load
Featured Projects
Space-Battle-Game on Scratch

Space Battle

This project will show you how to make a cool space battle game on your own in PictoBlox (Scratch-based programming) and play using your Smartphone!

All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart