EDF - OnePIC MCU  v1.1.0
RTCC
Collaboration diagram for RTCC:

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

Function Documentation

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.

Precondition:
Valid values of day, month and year must be presented in _time_chk structure.
Note:
input: _time_chk with valid values of day, month and year.
Returns:
Zero based week day in _time_chk structure.

Definition at line 543 of file OnePIC_rtcc.c.

void RTCCInit ( void  )

Enable the oscillator for the RTCC.

Note:
call this first before any other RTCC related function

Definition at line 389 of file OnePIC_rtcc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void RTCCProcessEvents ( void  )

grabs the current time from the RTCC and translate it into strings.

It updates time and date strings _day_time_str, _date_str, and _time, _time_chk structures.

Precondition:
RTCCInit must be called before.

Definition at line 208 of file OnePIC_rtcc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void RTCCReadOffTime ( RTCC t)

read the RTCC current Time

Parameters:
tRTCC structure that holds RTCC register copy

Definition at line 171 of file OnePIC_rtcc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void RTCCReadTime ( RTCC t)

read the RTCC current Time

Parameters:
tRTCC structure that holds RTCC register copy
Precondition:
RTCCInit must be called before.

Definition at line 147 of file OnePIC_rtcc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void RTCCSet ( void  )

uploads time and date from _time_chk into clock.

See also:
RTCC::_time_chk
Note:
Input: _time_chk - structure containing time and date.

Definition at line 441 of file OnePIC_rtcc.c.

Here is the call graph for this function:

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.

Parameters:
DayDay binary value.
Returns:
Checked BCD value in _time_chk structure.

Definition at line 589 of file OnePIC_rtcc.c.

Here is the caller graph for this function:

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.

Parameters:
HourHours binary value.
Returns:
Checked BCD value in _time_chk structure.

Definition at line 522 of file OnePIC_rtcc.c.

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.

Parameters:
MinMinutes binary value.
Returns:
Checked BCD value in _time_chk structure

Definition at line 506 of file OnePIC_rtcc.c.

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.

Parameters:
MonthMonth binary value.
Returns:
Checked BCD value in _time_chk structure.

Definition at line 623 of file OnePIC_rtcc.c.

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.

Parameters:
SecSeconds binary value.
Returns:
Checked BCD value in _time_chk structure.

Definition at line 490 of file OnePIC_rtcc.c.

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.

Parameters:
YearYear binary value.
Returns:
Checked BCD value in _time_chk structure.

Definition at line 639 of file OnePIC_rtcc.c.

Here is the call graph for this function:

void RTCCWriteTime ( RTCC t)

Write the RTCC current Time.

Precondition:
RTCCInit must be called before.
Parameters:
tRTCC structure that holds RTCC register copy

Definition at line 188 of file OnePIC_rtcc.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:
 {
    0x6f, 
    2, 
    0, 
    (unsigned char*) "\003\011", 
    rtccBuf,
    0, 
    0, 
    (void *) 0 
}

clears the RTcc

Definition at line 85 of file OnePIC_rtcc.c.

Initial value:
 {
    0x6f, 
    1, 
    0x20, 
    rtccWriteBuf, 
    rtccBuf,
    0, 
    0, 
    (void *) 0 
}

Reads 1 byte at address 0x20 (seconds)

Definition at line 100 of file OnePIC_rtcc.c.

Initial value:
 {
    0x6f, 
    4, 
    0, 
    rtccWriteBuf,
    rtccBuf,
    0, 
    0, 
    (void *) 0 
}

also write to its RAM

Definition at line 130 of file OnePIC_rtcc.c.

Initial value:
 {
    0x6f, 
    5, 
    0, 
    (unsigned char*) "\000\200\000\000\010", 
    rtccBuf,
    0, 
    0, 
    (void *) 0 
}

Sets "start" and VbatEn.

Definition at line 70 of file OnePIC_rtcc.c.

Initial value:
 {
    0x6f, 
    1, 
    0, 
    rtccWriteBuf,
    rtccBuf,
    0, 
    0, 
    (void *) 0 
}

write to RTCC

Definition at line 115 of file OnePIC_rtcc.c.