EDF - OnePIC MCU  v1.1.0
source/base/OnePIC_rtcc.c File Reference

performs all RTCC tasks More...

#include "OnePIC_rtcc.h"
#include "Compiler.h"
#include "OnePIC_i2c.h"
#include <string.h>
Include dependency graph for OnePIC_rtcc.c:

Go to the source code of this file.

Functions

void RTCCReadTime (RTCC *t)
 read the RTCC current Time
void RTCCReadOffTime (RTCC *t)
 read the RTCC current Time
void RTCCWriteTime (RTCC *t)
 Write the RTCC current Time.
void RTCCProcessEvents (void)
 grabs the current time from the RTCC and translate it into strings.
void RTCCInit (void)
 Enable the oscillator for the RTCC.
void RTCCClear ()
 Restart the clock.
void RTCCSet (void)
 uploads time and date from _time_chk into clock.
void RTCCUnlock (void)
 allows a writing into the clock registers.
void RTCCSetBinSec (unsigned char Sec)
 verifies setting seconds range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.
void RTCCSetBinMin (unsigned char Min)
 verifies a setting minutes range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.
void RTCCSetBinHour (unsigned char Hour)
 verifies a setting hours range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.
void RTCCCalculateWeekDay (void)
 reads day, month and year from _time_chk and calculates week day. Than It writes result into _time_chk. To write the structure into clock RTCCSet must be called.
void RTCCSetBinDay (unsigned char Day)
 verifies a setting day range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.
void RTCCSetBinMonth (unsigned char Month)
 verifies a setting month range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.
void RTCCSetBinYear (unsigned char Year)
 verifies a setting year range, translates it into BCD format and writes into _time_chk structure. To write the structure into clock RTCCSet must be called.

Variables

RTCC _time
 contains the time
RTCC _time_chk
 used as input/output for get/set operations
RTCC _pwr_off
 used to save time when power off
RTCC _pwr_on
 used to reload time when powered on
unsigned char temp [10]
 temporary buffer
char _day_time_str [16] = " "
 Contain date/time string -> Sat 10:01:15.
char _date_str [16] = " "
 Contians date string -> Sep 30, 2005.
char _time_str [9] = " "
 containg time string 12:32:49
unsigned char _rtcc_flag
 The flag stops updating time and date and used for get/set operations.
unsigned char rtccBuf [32]
 contains all RTCC bytes
unsigned char rtccWriteBuf [10]
 used for write operations
struct trb rtcStart
 Sets "start" and VbatEn.
struct trb rtcClearVbat
 clears the RTcc
struct trb rtcRead
 Reads 1 byte at address 0x20 (seconds)
struct trb rtcWrite
 write to RTCC
struct trb rtcSaveInRAM
 also write to its RAM

Detailed Description

performs all RTCC tasks

Author:
Chris Valenti
Date:
05-26-05
Author:
Ross Fosler
Date:
06-06-2005
Author:
Anton Alkhimenok
Date:
10-21-2005
Author:
Anton Alkhimenok
Date:
02-07-2008

Definition in file OnePIC_rtcc.c.