Real Time Clock And Calendar with battery backup

class MCP79410RTCC.Alarm[source]

Class representation of Alarms for RTCC chip.

ONE = 2
ZERO = 1
class MCP79410RTCC.MCP79410[source]

Bases: object

Representation of an MCP79410 RTCC chip.

CheckPowerFailure()[source]

Checks if there was a power failure.

Parameters:none
Returns:PowerFail - TRUE if there was a power failure, FALSE otherwise.
ClearInterruptFlag(alarm)[source]

Selects which alarm Interrupt flag should be cleared.

Parameters:alarm – One of the two alarms
Returns:none
DisableAlarm(alarm)[source]

Disables one of the two alarms.

Parameters:alarm – Alarm object , One of the two alarms, ZERO or ONE.
Returns:none
DisableOscillator()[source]

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

Parameters:none
Returns:none
DisableVbat()[source]

Disables the backup battery functionality.

Parameters:none
Returns:none
EnableAlarm(alarm, config)[source]

Enables the chosen alarm.

Parameters:
  • alarm – Alarm object , One of the two alarms, ZERO or ONE.
  • config
Returns:

none

EnableOscillator()[source]

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

Parameters:none
Returns:none
EnableVbat()[source]

Enables battery backup mode.

Parameters:none
Returns:none
GetAlarmStatus(alarm)[source]

Gets the status of the alarm interrupt flag.

Parameters:alarm – One of the two alarms, ZERO or ONE.
Returns:status - TRUE if alarm enabled , FALSE if disabled.
GetAlarmTime(time, alarm)[source]

Get the alarm time for one of the two alarms.

Parameters:
  • time – RTCC object
  • alarm – One of the two alarms
Returns:

alarm time

GetPMAM()[source]

Get AM or PM for 12 hour format.

Returns:meridian - PM/AM flag
GetPowerDownTime()[source]

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

Parameters:none
Returns:powerdown_time - Power down time structure.
GetPowerUpTime()[source]

Returns the time the system powered up.

Parameters:none
Returns:powerup_time - Power up time structure.
GetTime()[source]

Returns a time object with the current time from the RTCC.

Parameters:none
Returns:current_time - This is an RTCC class object that contains the time.
IsRunning()[source]

Checks if the on-chip clock is running.

Returns:ClockStatus - TRUE if clock is running , FALSE otherwise.
IsVBatEnabled()[source]

Check if the VBAT is enabled.

Parameters:none
Returns:status - True is battery mode is enabled , False otherwise.
SetAlarmMFPPolarity(MFP_pol, alarm)[source]

Get the alarm time on the reg.

Parameters:
  • MFP_pol – Multi function pin polarity
  • alarm – One of the two alarms
Returns:

none

SetAlarmMatch(match, alarm)[source]

Get the alarm time on the reg.

Parameters:
  • match – second, hour or mintue match from Match class
  • alarm – one of the two alarms
Returns:

none

SetAlarmTime(time, alarm)[source]

Sets the alarm time for one of the two alarms.

Parameters:
  • time – RTCC Class encapsulating time settings.
  • alarm – One of the two alarms,either alarm ZERO or ONE.
Returns:

none

SetHourFormat(format)[source]

Sets the hour format according to standard or military format.

Parameters:format – Type of format is either 24 or 12.
Returns:none
SetMFP_Functionality(mode)[source]

This function sets the MFP pin mode.

Parameters:mode – Mode of the MFP pin.
Returns:none
SetMFP_GPOStatus(status)[source]

Sets the MFP output logic level when the pin is configured as GPO

Parameters:status – Polarity of MFP pin , Asserted output state of MFP is a logic low level for LOW and opposite for HIGH
Returns:none
SetPMAM(meridian)[source]

Sets the meridian mode.

Parameters:meridian – PMAM_t object ,either PMT or AMT settings
Returns:none
SetTime(RTCtime)[source]

Initializes the RTCC with a specific time contained in the time structure.

Parameters:RTCtime – RTCC class object that contains the time to be set.
Returns:none
bcd2dec(num)[source]

Convert the value from Binary Coded Decimal (BCD) to Decimal.

Parameters:num – Number to convert to decimal.
Returns:dec - Decimal representation of number.
bcdtobin(num)[source]

Convert the value from BCD to binary.

Parameters:num – Number to convert to binary.
Returns:bin - Binary representation of number.
dec2bcd(num)[source]

Convert the value from decimal to Binary Coded Decimal (BCD).

Parameters:num – Number to convert to BCD
Returns:bcd - BCD representation of number.
readRegister(rtcc_reg)[source]

Read the value of the register.

Parameters:rtcc_reg – Address of the register.
Returns:Register byte content
writeRegister(rtcc_reg, dat)[source]

Write a new value on the register.

Parameters:
  • rtcc_reg – Address of the register.
  • dat – Byte value to be written on the register.
Returns:

none

class MCP79410RTCC.Match[source]

Class representation of Alarm match settings for RTCC chip.

DATE_MATCH = 4
FULL_DATE_MATCH = 5
HOURS_MATCH = 2
MINUTES_MATCH = 1
SECONDS_MATCH = 0
WEEKDAY_MATCH = 3
class MCP79410RTCC.Mode[source]

Class representation of Mode settings for RTCC chip.

ALARM_INTERRUPT = 1
GPO = 0
SQUARE_WAVE = 2
class MCP79410RTCC.PMAM_t[source]

Class representation for PM/AM settings for RTCC chip.

AMT = 0
PMT = 1
class MCP79410RTCC.Polarity[source]

Class representation of Polarity settings for RTCC chip.

HIGHPOL = 1
LOWPOL = 0
class MCP79410RTCC.RTCC_Struct(sec, min, hour, weekday, date, month, year)[source]

Bases: object

RTCC time object.

Previous topic

NOR Flash Memory 2Mbit

Next topic

1Kbit EEPROM

This Page