【文件属性】:
文件名称:DS1302时钟 1602液晶显示
文件大小:9KB
文件格式:C
更新时间:2012-10-20 04:57:38
DS1302时钟 1602液晶显示
//寄存器宏定义
#include
#include
#define WRITE_SECOND 0x80
#define WRITE_MINUTE 0x82
#define WRITE_HOUR 0x84
#define WRITE_DATE 0x86
#define WRITE_MONTH 0x88
#define WRITE_DAY 0x8A
#define WRITE_YEAR 0x8C
#define READ_SECOND 0x81
#define READ_MINUTE 0x83
#define READ_HOUR 0x85
#define READ_DATE 0x87
#define READ_MONTH 0x89
#define READ_DAY 0x8B
#define READ_YEAR 0x8D
#define WRITE_PROTECT 0x8E
#define uchar unsigned char
//位寻址寄存器定义
sbit ACC_7 = ACC^7;
//管脚定义
sbit sclk=P3^0; // DS1302时钟信号 7脚
sbit io=P3^1; // DS1302数据信号 6脚
sbit rst=P3^2; // DS1302片选 5脚
sbit RS=P3^3;