⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 从pcf8563中读取时间子程序 程序.c

📁 单片机数据通讯典型应用(光盘内容)
💻 C
字号:
//**********从PCF8563中读取时间子程序PCF8563_read_time()******

void PCF8563_read_time(struct time * ptm)
{
IIC_read_lendata(0xA2,2,*ptm,sizeof(struct time)); 
//从PCF8563中读取时间//PCF8563的地址为0xA2;从秒开始读。
ptm->second &=0x7F;           //取秒字节,屏蔽无效位
ptm->minute &=0x7F;            //取分钟字节,屏蔽无效位
ptm->hour &=0x3F;              //取小时字节,屏蔽无效位
ptm->day &=0x3F;               //取天字节,屏蔽无效位
ptm->weekday &=0x07;           //取星期字节,屏蔽无效位
ptm->mon &=0x1F;               //取月字节,屏蔽无效位
ptm->year &=0xFF;              //取年字节,屏蔽无效位
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -