whycyhl
2022-05-05 683c912f9ac1935a7b109fb402bb276dba450f6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/************************** Copyright (c) **********************************
**                 FUZHOU FUGUANG ELECTRONICS Co.,LTD.
**                        ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
**                       http://www.fuguang.com
**
**-------------- File Info -------------------------------------------------
** File name:            DS1302_Driver.h
** Last modified Date:  2008-11-16
** Last Version:        1.0
** Descriptions:        DS1302 Drivers lib
**
**--------------------------------------------------------------------------
** Created by:            mxpopstar
** Created date:        2008-11-16
** Version:                1.0
** Descriptions:        The original version
**
**--------------------------------------------------------------------------
** Modified by:            mxpopstar
** Modified date:        2008-11-20
** Version:
** Descriptions:        DS1302 Drivers lib
**
***************************************************************************/
//
 
#ifndef DS1302_Dri_H
#define DS1302_Dri_H
 
#define RST_DS1302_1           PORTB |= 0x10
#define RST_DS1302_0           PORTB &= (~0x10)    //PINB4
 
#define IO_DS1302_1            PORTB |= 0x20
#define IO_DS1302_0            PORTB &= (~0x20)    //PINB5
 
#define IO_Direction_OUT      DDRB |= 0x20         //ÉèÖÃIOÒý½ÅΪÊä³ö
#define IO_Direction_IN      DDRB &= (~0x20)     //ÉèÖÃIOÒý½ÅΪÊäÈë
 
#define Data_DS1302_1          PINB & 0x20            //¶ÁÈ¡DS1302Êä³öµÄÊý¾Ý
 
#define SCLK_DS1302_1       PORTB |= 0x40
#define SCLK_DS1302_0       PORTB &= (~0x40)    //PINB6
 
 
 
#include <avr/io.h>
#include <util/delay.h>
#include "Define.h"
 
void InitIO_DS1302(void);
void Config_DS1302(void);
void GetDateTime(Date_Time *datetime);
void SetDateTime(const Date_Time *datetime);
void Ds1302_Write_Byte(const unsigned char command, const unsigned char data);
unsigned char Ds1302_Read_Byte(const unsigned char command);
 
#endif
//