第三次优化代码,增加支持keil4的注释,此外优化LCD1602显示
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef __DS1302_H_
|
||||
#define __DS1302_H_
|
||||
|
||||
/* 包含头文件 */
|
||||
#include<reg51.h>
|
||||
#include<intrins.h>
|
||||
|
||||
/* 数据类型重定义 */
|
||||
#ifndef uchar
|
||||
#define uchar unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef uint
|
||||
#define uint unsigned int
|
||||
#endif
|
||||
|
||||
/* DS1302使用的IO口定义 */
|
||||
sbit DSIO=P1^1; /* 数据线 */
|
||||
sbit RST=P1^2; /* 复位/使能线 */
|
||||
sbit SCLK=P1^0; /* 时钟线 */
|
||||
|
||||
/* 外部函数声明 */
|
||||
void Ds1302Write(uchar addr, uchar dat); /* 写DS1302 */
|
||||
uchar Ds1302Read(uchar addr); /* 读DS1302 */
|
||||
void Ds1302Init(); /* 初始化DS1302 */
|
||||
void Ds1302ReadTime(); /* 读取DS1302时间 */
|
||||
|
||||
/* 外部全局变量声明 */
|
||||
extern uchar TIME[7]; /* 时间数组 */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user