/******************************************************************************
* File name --> <strong><font color="#FF0000">ds1302</font></strong>.c
* Author --> By Sam Chan
* Version -->
* Date --> 08 - 23 - 2012
* Brief --> 时钟芯片DS1302驱动
*
* Copyright (C) 20**
* All rights reserved
*******************************************************************************
*
* File Update
* Version -->
* Author --> By Sam Chan
* Date --> 10 - 20 - 2013
* Revise --> A、增加对STM32控制的移植支持
* --> B、增加对置的RAM操作相关函数
* --> C、增加检测DS1302是否存在,是否第一次上电检测函数
* --> D、增加对DS1302置的锂电池充电寄存器参数设置函数和结构体
*
******************************************************************************/
#include ""
/******************************************************************************
定义变量
******************************************************************************/
#define Date
#define Min
#define Sec
#define Hour
#define Week
#define Month
#define Year
Time_Typedef TimeValue; //定义时间数据指针
void Time_Init()
{
=24;
=6;
=12;
=5;
=0;
=2;
=16;
}
Charge_Typedef ChargeValue; //定义充电寄存器
/******************************************************************************
* Function Name --> GPIO初始化
* Description --> none
* Input --> none
* Output --> none
* Reaturn --> none
******************************************************************************/
void DS1302_GPIOInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
ds1302程序-stm 来自淘豆网m.daumloan.com转载请标明出处.