Menu

PCF85x3 CMOS Real-Time Clock (RTC) and calendar

Anobium
2019-01-31
2019-01-31
  • Anobium

    Anobium - 2019-01-31

    Just post a new clock. This is in support of the PicSimLab board project being led by Chris Roper.

    The PCF85x3 is a CMOS Real-Time Clock (RTC) and calendar optimized for low power consumption. A programmable clock output, interrupt output, and voltage-low detector are also provided. All addresses and data are transferred serially via a two-line bidirectional I 2C-bus. Maximum bus speed is 400 kbit/s. The register address is incremented automatically after each written or read data byte.

    The PCF8563 is more accurate than the DS13x7 RTCs. See the application note AN10652 for more details.

    To use, include the following:

    #include <PCF85X3.h>
    

    Here follows a list of the commands..

    PCF85X3_Enable(flag)
    • enables the clock when flag is TRUE,
    • disables the clock when flag is FALSE

    PCF85X3_ResetClock
    • resets clock completely to default original condition,
    • set clock to default time/date.

    PCF85X3_SetClock( hour, minute, second, date, dow, month, year )
    • sets the entire clock to the specified values.

    PCF85X3_SetTime( hour, minute, second )
    • sets the clock to the specified values.

    PCF85X3_ReadClock( hour, minute, second, date, dow, month, year )
    • read the clock to the specified variables.

    PCF85X3_ReadTime( hour, minute, second )
    • read the clock to the specified variables.

    PCF85x3_SetDate(date, dow, month, year)
    • sets the clock to the specified values.

    PCF85x3_ReadDate(date, dow, month, year)
    • read the clock to the specified variables.

    PCF85x3_SetAlarm( hour, minute, date , dow )
    PCF85x3_SetAlarm( hour, minute )
    PCF85x3_SetAlarm( minute )
    • sets the alarm clock to the specified values to the specific clock registers.

    PCF85x3_EnableAlarm ( boolean_flag )
    • set the state of the alarm to enable or disable for true and false respectively.

    PCF85x3_DisableAlarms
    • disables the alarm.

    PCF85x3_ClearAlarm
    • clear an active alarm state ready of next alarm event.

    function PCF85x3_AlarmState returns ( boolean_flag )
    • returns the state of the alarm event flag.

    function PCF85x3_ReadVL returns ( boolean_flag )
    • returns the state of the voltage integrity flag.

    function PCF85x3_ReadAlarmState returns ( boolean_flag )
    • returns the state of the alarm event flag.

    PCF85x3_SetInterrupt( boolean_flag )
    • set the external interrupt port active

    PCF85X3WriteRegister(address, value)
    • writes to the internal registers.

    PCF85X3_ReadRegister(address, out value)
    • reads from the internal registers.

    The library is available from the code library and will be included in future releases.

    Demonstration code is in GitHub here: https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources/tree/master/Real_Time_Clock_Solutions

    The demonstration code for the PicSimLab project is in GitHub here: https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources/tree/master/Vendor_Boards/picsimlab/board_2

     
  • Anobium

    Anobium - 2019-01-31

    A demonstration. Time is a tad fast... this is the GIF file not the clock!!!

     

    Last edit: Anobium 2019-01-31

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.