电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

DS1302程序(51专用1602显示)

DS1302程序(51专用1602显示)_第1页
1/6
DS1302程序(51专用1602显示)_第2页
2/6
DS1302程序(51专用1602显示)_第3页
3/6
此版本时钟程序是在其他网友提供的程序的基础上修改而成,这里仅仅显示了小时,分,秒这个三个参数,日期和星期等读者可以自行加上,语句基本一样,仅仅需要多设几个变量,调用Read1302()函数即可。该程序还有待改进,下次把完全版的程序传上来。有好建议的网友欢迎和我交流。 #include //宏定义 #define LCD_RW P1_1 //定义 LCD 引脚,控制口 #define LCD_RS P1_2 #define LCD_E P1_0 #define LCD_Data P2 //数据传送口 #define Write_second 0x80 #define Write_minute 0x82 #define Write_hour 0x84 #define Write_day 0x86 #define Write_month 0x88 #define Write_week 0x8a #define Write_year 0x8c #define Read_second 0x81 #define Read_minute 0x83 #define Read_hour 0x85 #define Read_day 0x87 #define Read_month 0x89 #define Read_week 0x8B #define Read_year 0x8D #define Write_protect 0x8E ///#define Busy 0x80 //用于检测 LCD 状态字中的Busy标识 sbit ACC_7=ACC^7; sbit ACC_0=ACC^0; sbit SCLK=P1^3; sbit DO=P1^4; sbit CE=P1^5; unsigned char code table[]="0123456789"; //函数声明 void LCDInit(void); void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData); void DisplayListChar(unsigned char X, unsigned char Y, unsigned char code *DData); void Delay5Ms(void); void WriteDataLCD(unsigned char WDLCD); void WriteCommandLCD(unsigned char WCLCD,BuysC); void ReadStatusLCD(void); //5ms 延时 void Delay5Ms(void) { unsigned int TempCyc = 5552; while(TempCyc--); } //读状态,检测忙 void ReadStatusLCD(void) { LCD_Data = 0xFF; LCD_RS=0; LCD_RW=1; LCD_E=0; LCD_E=0; LCD_E=1; while (LCD_Data & 0x80); //检测忙信号 // return(LCD_Data); } //写数据 void WriteDataLCD(unsigned char WDLCD) { ReadStatusLCD(); //检测忙 LCD_Data=WDLCD; LCD_RS=1; LCD_RW=0; LCD_E=0; //若晶振速度太高可以在这后加小的延时 LCD_E=0; //延时 LCD_E=1; } //写指令 void WriteCommandLCD(unsigned char WCLCD,BuysC) //BuysC 为 0 时忽略忙检测 { if (BuysC) ReadStatusLCD...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

DS1302程序(51专用1602显示)

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部