51单片机ds1302实时时钟程序.docVIP

  • 0
  • 0
  • 约5.24千字
  • 约 3页
  • 2019-06-25 发布于河北
  • 举报
51单片机ds1302实时时钟程序

#ifndef __DS1302_H_ #define __DS1302_H_ //---包含头文件---// #includereg51.h #includeintrins.h //---重定义关键词---// #ifndef uchar #define uchar unsigned char #endif #ifndef uint #define uint unsigned int #endif //---定义ds1302使用的IO口---// sbit DSIO=P3^4; sbit RST=P3^5; sbit SCLK=P3^6; //---定义全局函数---// void Ds1302Write(uchar addr, uchar dat); uchar Ds1302Read(uchar addr); void Ds1302Init(); void Ds1302ReadTime(); //---加入全局变量--// extern uchar TIME[7]; //加入全局变量 #endif #includeds1302.h //---DS1302写入和读取时分秒的地址命令---// //---秒分时日月周年 最低位读写位;-------// uchar code READ_RTC_ADDR[7] = {0x81, 0x83, 0x85, 0x87, 0x89, 0x

文档评论(0)

1亿VIP精品文档

相关文档