RTC Calibration DEMO

The purpose of this project is to demonstrate
the self-correcting RTC calibration feature.
The RTC Calibration value can be changed by
defining a new RTCCAL value (in RTC.H).

In reality, the RTC calibration value would be
much larger than what is shown in this demo.
In this example, RTC calibration value is set
to 3 so that it can be easily observed on the
4bit LED values.

RTC is clocked by the RTC oscillator.
Timer 0 is clocked by the main oscillator and is
divided down to 18 MHz.

Initially, both counters start counting from value
(0x00). Once the calibration counter reaches the RTC
calibration value, it will then perform the designated
correction. 

	CALVAL value range: 0x0 - 0x1FFFF

The corrective action is specified by
CALDIR (RTC.H).
	
	CALDIR = 0	==> Forward correction
	CALDIR = 1	==> Backward correction

Both timer values (only the lower 4 bits) are outputted
onto the board's LEDs and onto the Graphic LCD.

---Graphic LCD---
The graphic LCD displays both the times from Timer 0 and
the RTC registers.
It also shows when and in what direction an auto 
calibration will be performed.

Time Format:		DD:HH:MM:SS

---LED Output---
The upper nibble being Timer0 and the lower nibble the RTC.

						8 Board LEDS

  P1.28--P1.29--P1.31--P2.2---P2.3---P2.4---P2.5---P2.6
 |                         | |                         |
 |_[3]____[2]____[1]___[0]_| |_[3]____[2]____[1]___[0]_|
  			TIMER0						 RTC

				-----Optional output-----
if "#define TIMER_0_VALUE_OUTPUT" == 0 (in main.c)
it will indicate a clock pulse at every LED toggle on P1.28
instead of Timer 0's 4-bit value.