LCD数字时钟(LCD1602)?
发布网友
发布时间:2022-04-22 09:11
我来回答
共1个回答
热心网友
时间:2023-06-22 07:14
下面是一个用AT89S52做的LCD1602显示的电子钟,可以调时间!\x0d\x0a\x0d\x0a#include
\x0d\x0a#define uchar unsigned char \x0d\x0a#define uint unsigned int\x0d\x0a\x0d\x0asbit rs= P2^0;\x0d\x0asbit rw = P2^1;\x0d\x0asbit ep = P2^2;\x0d\x0asbit k1=P1^0; //时,分选择键\x0d\x0asbit k2=P1^1; //加\x0d\x0asbit k3=P1^2; //减\x0d\x0achar i,j,shi,fen,miao;\x0d\x0auchar num,count,con;\x0d\x0a\x0d\x0a//uchar SJ[]={\x0d\x0a//0x08,0x0f,0x12,0x0f,0x0a,0x1f,0x02,0x02,//年\x0d\x0a//0x0f,0x09,0x0f,0x09,0x0f,0x09,0x0b,0x11,//月\x0d\x0a//0x0f,0x09,0x09,0x0f,0x09,0x09,0x0f,0x00//日\x0d\x0a//};\x0d\x0a\x0d\x0auchar code table1[]={'2','0','1','0','-','1','1','-','0','4',' ',' ','T','H','U'};\x0d\x0auchar code table2[]=" 00:00 00";\x0d\x0a//uchar code table3[]=" 15899576222";\x0d\x0a \x0d\x0avoid lcd_com(uchar com);\x0d\x0avoid jia();\x0d\x0avoid jian();\x0d\x0avoid keyscan();\x0d\x0avoid lcd_date(uchar date);\x0d\x0avoid lcd_init();\x0d\x0avoid lcd_sfm(uchar add,uchar date);\x0d\x0a\x0d\x0avoid delay(uint t)\x0d\x0a{\x0d\x0a uint i,j;\x0d\x0a for(i=0;i=12)\x0d\x0a {\x0d\x0a// lcd_sfm(1,"PM");\x0d\x0a }\x0d\x0a if(shi==24)\x0d\x0a {\x0d\x0a shi=0;\x0d\x0a }\x0d\x0a lcd_sfm(4,shi);\x0d\x0a }\x0d\x0a lcd_sfm(7,fen);\x0d\x0a }\x0d\x0a lcd_sfm(10,miao);\x0d\x0a } \x0d\x0a}