unsigned char time_buf[8] = {0x20,0x18,0x08,0x01,0x00,0x00,0x00,0x03};//20180801 00:00:00 周三
ds1302_init(); //DS13023õê¼»ˉ
ds1302_write_byte(ds1302_control_add,0x00); //关写保护
ds1302_write_byte(ds1302_sec_add,0x80); //暂时停掉时钟
//ds1302_write_byte(ds1302_charger_add,0xa9); //涓涓充电
ds1302_write_byte(ds1302_year_add,time_buf[1]); //年
ds1302_write_byte(ds1302_month_add,time_buf[2]); //月
ds1302_write_byte(ds1302_date_add,time_buf[3]); //日
ds1302_write_byte(ds1302_hr_add,time_buf[4]); //时
ds1302_write_byte(ds1302_min_add,time_buf[5]); //分
ds1302_write_byte(ds1302_sec_add,time_buf[6]); //秒
ds1302_write_byte(ds1302_day_add,time_buf[7]); //周
ds1302_write_byte(ds1302_control_add,0x80); //开写保护 |