configrealtimeclock.c

来自「ti-Chipcon CC1010 1G以下Soc源码库。包括rf,powerm」· C语言 代码 · 共 56 行

C
56
字号
/*****************************************************************************
 *                                                                           *
 *        **********                                                         *
 *       ************                                                        *
 *      ***        ***                                                       *
 *      ***   +++   ***                                                      *
 *      ***   + +   ***                                                      *
 *      ***   +                            CHIPCON CC1010                    *
 *      ***   + +   ***              HAL - ConfigRealtimeClock               *
 *      ***   +++   ***                                                      *
 *      ***       ***                                                        *
 *       ***********                                                         *
 *        *********                                                          *
 *                                                                           *
 *****************************************************************************
 *                                                                           *
 *****************************************************************************
 * Author:              ROH                                                  *
 *****************************************************************************
 * Revision history:                                                         *
 *                                                                           *
 * $Log: ConfigRealtimeClock.c,v $
 * Revision 1.1  2002/10/14 13:04:30  tos
 * Initial version in CVS.
 *
 *                                                                           *
 ****************************************************************************/

#include <chipcon/hal.h>

//----------------------------------------------------------------------------
// void halConfigRealtimeClock(...);
//
//  Description:
//      This function configures the realtime clock. It's period in seconds
//      is given in _period_. In order for the realtime clock to function
//      the 32 kHz oscillator must be connected to a 32 kHz crystal or a 32 kHz
//      clock signal must be available on pin XOSC32_Q1. The 32 kHz oscillator
//      must be started up and stable before the RTC is activated.
//      The realtime clock must be started by using the macro RTC_RUN(TRUE).
//
//  Arguments:
//      byte period
//          The desired period between interrupts in seconds.
//
//  Return value:
//      void
//----------------------------------------------------------------------------
void halConfigRealTimeClock(byte period) {
    RTCON = (RTCON&0x80) | (period&0x7F);
    RTCIF=0;
    RTCIE=1;
    EA=1;
}    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?