定义:DS1302为时钟芯片。
配置特点:1.定位到地址 2.写入数据。
如你要写59秒,那便先确定他的地址0x80,在编写它的数据0x59。若要写9月,那便先写0x88(它的地址,再写数据0x09)。
( 手册中的详细地址)
它的编写时序(规则)代码如下
#include "ds1302.h"
//写字节
void Write_Ds1302(unsigned char temp)
{
unsigned char i;
for (i=0;i<8;i++)
{
SCK = 0;
SDA = temp&0x01;
temp>>=1;
SCK=1;
}
}
//向DS1302寄存器写入数据
void Wri