Sensorian  1.0
C API Reference Guide Library
Real Time Clock and Calendar

Functions

void MCP79410_Initialize (void)
 Initializes the RTCC with the system time. More...
 
void MCP79410_EnableOscillator (void)
 Enables the clock oscillator. This must be enabled in order for the RTCC to run. More...
 
void MCP79410_DisableOscillator (void)
 Disables the clock oscillator.The RTCC does not operate once the oscillator is stopped. More...
 
unsigned char MCP79410_IsRunning (void)
 Checks if the chip clock is running. More...
 
RTCC_StructMCP79410_GetTime (void)
 The function returns a time structure with the current time from the RTCC. More...
 
void MCP79410_SetTime (RTCC_Struct *time)
 This function initializes the RTCC with a specific time contained in the time structure. More...
 
void MCP79410_SetHourFormat (Format_t format)
 This function sets the hour format. More...
 
void MCP79410_SetPMAM (PMAM_t meridian)
 This function sets the meridian mode. More...
 
void MCP79410_EnableAlarm (Alarm_t alarm)
 This function sets the alarm time. More...
 
void MCP79410_DisableAlarm (Alarm_t alarm)
 This function disables one of the two alarms. More...
 
AlarmStatus_t MCP79410_GetAlarmStatus (Alarm_t alarm)
 This function gets the status of the alarm interrupt flag. More...
 
void MCP79410_ClearInterruptFlag (Alarm_t alarm)
 Clears the interrupt alarm flag. More...
 
void MCP79410_SetAlarmTime (RTCC_Struct *time, Alarm_t alarm)
 This function sets the alarm time for one of the two alarms. More...
 
void MCP79410_SetAlarmMFPPolarity (Polarity_t MFP_pol, Alarm_t alarm)
 This function sets the MFP polarity either high or low. More...
 
void MCP79410_SetAlarmMatch (Match_t match, Alarm_t alarm)
 Alarm Asserts on Match on seconds, minutes ,hours depending on match parameter. More...
 
void MCP79410_SetMFP_Functionality (MFP_t mode)
 This function sets the MFP pin mode. More...
 
void MCP79410_SetMFP_GPOStatus (Polarity_t status)
 This function sets the MFP output logic level when the pin is configured as GPO. More...
 
unsigned char MCP79410_CheckPowerFailure (void)
 This function checks if there was a power failure. More...
 
unsigned char MCP79410_IsVbatEnabled (void)
 This function checks if battery mode is enabled. More...
 
void MCP79410_EnableVbat (void)
 This function enables backup battery mode. More...
 
void MCP79410_DisableVbat (void)
 This function disables the backup battery functionality. More...
 
RTCC_StructMCP79410_GetPowerUpTime (void)
 This function returns the power-up time of the RTCC. More...
 
RTCC_StructMCP79410_GetPowerDownTime (void)
 This function returns the power-down time of the RTCC. More...
 
unsigned char MCP79410_dec2bcd (unsigned char num)
 Convert Binary Coded Decimal (BCD) to Decimal. More...
 
unsigned char MCP79410_bcd2dec (unsigned char num)
 Convert Binary Coded Decimal (BCD) to Decimal. More...
 

Detailed Description

These functions allow the user to leverage the RTCC time keeping capabilities and alarm settings.

Function Documentation

unsigned char MCP79410_bcd2dec ( unsigned char  num)

Convert Binary Coded Decimal (BCD) to Decimal.

Parameters
numNumber to be converted to decimal
Returns
dec Decimal value of BCD number

Definition at line 570 of file MCP79410.c.

unsigned char MCP79410_CheckPowerFailure ( void  )

This function checks if there was a power failure.

Returns
none

Definition at line 465 of file MCP79410.c.

void MCP79410_ClearInterruptFlag ( Alarm_t  alarm)

Clears the interrupt alarm flag.

Parameters
alarmSelects which alarm Interrupt flag should be cleared
Returns
none

Definition at line 276 of file MCP79410.c.

unsigned char MCP79410_dec2bcd ( unsigned char  num)

Convert Binary Coded Decimal (BCD) to Decimal.

Parameters
numNumber to be converted to BCD
Returns
bcd BCD value of decimal number.

Definition at line 560 of file MCP79410.c.

void MCP79410_DisableAlarm ( Alarm_t  alarm)

This function disables one of the two alarms.

Parameters
alarmDisables one of the two alarms.
Returns
none

Definition at line 240 of file MCP79410.c.

void MCP79410_DisableOscillator ( void  )

Disables the clock oscillator.The RTCC does not operate once the oscillator is stopped.

Returns
none

Definition at line 73 of file MCP79410.c.

void MCP79410_DisableVbat ( void  )

This function disables the backup battery functionality.

Returns
none

Definition at line 515 of file MCP79410.c.

void MCP79410_EnableAlarm ( Alarm_t  alarm)

This function sets the alarm time.

Parameters
alarmEnables one of the two alarms.
Returns
none

Definition at line 222 of file MCP79410.c.

void MCP79410_EnableOscillator ( void  )

Enables the clock oscillator. This must be enabled in order for the RTCC to run.

Returns
none

Definition at line 62 of file MCP79410.c.

void MCP79410_EnableVbat ( void  )

This function enables backup battery mode.

Returns
none

Definition at line 503 of file MCP79410.c.

AlarmStatus_t MCP79410_GetAlarmStatus ( Alarm_t  alarm)

This function gets the status of the alarm interrupt flag.

Parameters
alarmOne of the two alarms, ZERO or ONE.
Returns
none

Definition at line 258 of file MCP79410.c.

RTCC_Struct * MCP79410_GetPowerDownTime ( void  )

This function returns the power-down time of the RTCC.

Returns
powerdown_time Struct of type RTCC_Struct containg power down time.

Definition at line 543 of file MCP79410.c.

RTCC_Struct * MCP79410_GetPowerUpTime ( void  )

This function returns the power-up time of the RTCC.

Returns
powerup_time Struct of type RTCC_Struct containg power up time.

Definition at line 527 of file MCP79410.c.

RTCC_Struct * MCP79410_GetTime ( void  )

The function returns a time structure with the current time from the RTCC.

Returns
current_time This is an RTCC_Struct pointer. Refer to the documenation of this data structure.

Definition at line 100 of file MCP79410.c.

void MCP79410_Initialize ( void  )

Initializes the RTCC with the system time.

Returns
none

Definition at line 43 of file MCP79410.c.

unsigned char MCP79410_IsRunning ( void  )

Checks if the chip clock is running.

Returns
ClockStatus Variable is TRUE if clock is running , FALSE otherwise.

Definition at line 84 of file MCP79410.c.

unsigned char MCP79410_IsVbatEnabled ( void  )

This function checks if battery mode is enabled.

Returns
status True is battery mode is enabled , False otherwise.

Definition at line 486 of file MCP79410.c.

void MCP79410_SetAlarmMatch ( Match_t  match,
Alarm_t  alarm 
)

Alarm Asserts on Match on seconds, minutes ,hours depending on match parameter.

Parameters
matchMatch setting
alarmSelect either alarm ZERO or ONE
Returns
none

Definition at line 364 of file MCP79410.c.

void MCP79410_SetAlarmMFPPolarity ( Polarity_t  MFP_pol,
Alarm_t  alarm 
)

This function sets the MFP polarity either high or low.

Parameters
MFP_polpolarity of MFP pin , Asserted output state of MFP is a logic low level for LOW and opposite for HIGH
alarmOne of the two alarms, either alarm ZERO or ONE.
Returns
none

Definition at line 331 of file MCP79410.c.

void MCP79410_SetAlarmTime ( RTCC_Struct time,
Alarm_t  alarm 
)

This function sets the alarm time for one of the two alarms.

Parameters
*timePointer of type RTCC_Struct encapsulating time settings.
alarmOne of the two alarms,either alarm ZERO or ONE.
Returns
none

Definition at line 297 of file MCP79410.c.

void MCP79410_SetHourFormat ( Format_t  format)

This function sets the hour format.

Parameters
formatType of format is Format_t.
Returns
none

Definition at line 184 of file MCP79410.c.

void MCP79410_SetMFP_Functionality ( MFP_t  mode)

This function sets the MFP pin mode.

Parameters
modeMode of the MFP pin.
Returns
none

Definition at line 414 of file MCP79410.c.

void MCP79410_SetMFP_GPOStatus ( Polarity_t  status)

This function sets the MFP output logic level when the pin is configured as GPO.

Parameters
statusPolarity of MFP pin , Asserted output state of MFP is a logic low level for LOW and opposite for HIGH
Returns
none

Definition at line 447 of file MCP79410.c.

void MCP79410_SetPMAM ( PMAM_t  meridian)

This function sets the meridian mode.

Parameters
meridianSet either PM or AM settings.
Returns
none

Definition at line 203 of file MCP79410.c.

void MCP79410_SetTime ( RTCC_Struct time)

This function initializes the RTCC with a specific time contained in the time structure.

Parameters
timeRTCC struct that contains the time to be set
Returns
none

Definition at line 125 of file MCP79410.c.