#include <reg52.h>
#include "delay.h"
#define ds1302_sec_add 0x80 //??¨ºy?Y¦Ì??¡¤
#define ds1302_min_add 0x82 //¡¤?¨ºy?Y¦Ì??¡¤
#define ds1302_hr_add 0x84 //¨º¡À¨ºy?Y¦Ì??¡¤
#define ds1302_date_add 0x86 //¨¨?¨ºy?Y¦Ì??¡¤
#define ds1302_month_add 0x88 //??¨ºy?Y¦Ì??¡¤
#define ds1302_day_add 0x8a //D??¨²¨ºy?Y¦Ì??¡¤
#define ds1302_year_add 0x8c //?¨º¨ºy?Y¦Ì??¡¤
#define ds1302_control_add 0x8e //????¨ºy?Y¦Ì??¡¤
#define ds1302_charger_add 0x90
#define ds1302_clkburst_add 0xbe
sbit RST = P1^0;
sbit SCK = P1^1;
sbit IO = P1^2;
unsigned char w_tbuf = 3;
unsigned char writeweek = 0;
unsigned char readweek = 0;
unsigned char disweek = 0;
unsigned char tempbuf[3];
unsigned char readbuf[3];
unsigned char disbuf[3];
unsigned char writebuf[3];
unsigned char w_dbuf[3];
unsigned char r_dbuf[3];
unsigned char d_dbuf[3];
unsigned char datebuf[3] = {
16,8,17};
unsigned char timebuf[3] = {
16,01,35};
//unsigned char weekbuf[7] = {MON,TUE,WED,THU,FRI,SAT,SUN};
#define LCDPORT P0
sbit RS = P2^4;
sbit RW = P2^5;
sbit E = P2^6;
#define LCD_WRITE_DATA 1
#define LCD_WRITE_COM 0
void lcd_write(unsigned char byte, unsigned char flag)
{
if(flag)
单片机==ds1302_时间日期周几(30)
最新推荐文章于 2023-07-24 17:46:42 发布
本文详细介绍了如何使用单片机配合DS1302芯片设置和显示时间、日期以及星期的功能,包括通信协议和编程实现步骤。
摘要由CSDN通过智能技术生成