|
这是主函数
本帖最后由 wyf1101 于 2016-8-19 21:23 编辑
- void main()
- {
- LCD_init(); //初始化液晶
- LCD_clear();
- Ds1302Init();
- LCD_write_english_string(0,1," 2016.08.17 ");
- LCD_write_english_string(0,3,"DS:00:00:00 ");
- LCD_write_english_string(0,5," crazyer ");
- LCD_write_english_string(0,1," 00:00:00 ");
- LCD_write_english_string(0,2,"wendu: 00.00 C");
- LCD_write_english_string(0,4,"DS 00:00:00 ");
- dd=0;
- while(1)
- {
- Ds1302ReadTime();
- temp1 = Ds18b20ReadTemp();
- temp1=(temp1*0.0625*100+0.5)*10;
- q=temp1 / 1000;
- b=temp1 % 1000 / 100;
- s=temp1 % 100 / 10;
- g=temp1%10;
- xianshi(3,7,q); delay(1);
- xianshi(3,8,b); delay(1);
- xianshi(3,9,'.'-48);delay(1);
- xianshi(3,10,s); delay(1);
- xianshi(3,11,g);
- delay(1);
-
- szshi1=TIME[2]/16;
- szshi2=(TIME[2]&0x0f);
- szfen1=TIME[1]/16;
- szfen2=(TIME[1]&0x0f);
- szmiao1=TIME[0]/16;
- szmiao2=(TIME[0]&0x0f);
- sznian1=TIME[6]/16;
- sznian2=(TIME[6]&0x0f);
- szyue1=TIME[4]/16;
- szyue2=(TIME[4]&0x0f);
- szri1=TIME[3]/16;
- szri2=(TIME[3]&0x0f);
- szxq1=TIME[5]/16;
- szxq2=(TIME[5]&0x0f);
- xianshi(1,2,2);
- xianshi(1,3,0);
- xianshi(1,4,sznian1); delay(1);
- xianshi(1,5,sznian2); delay(1);
- // LCD_write_english_string(2,7,"-");
- xianshi(1,7,szyue1); delay(1);
- xianshi(1,8,szyue2); delay(1);
- // LCD_write_english_string(2,11,"-");
- xianshi(1,10,szri1); delay(1);
- xianshi(1,11,szri2); delay(1);
-
- xianshi(2,3,szshi1); delay(1);
- xianshi(2,4,szshi2); delay(1);
- // LCD_write_english_string(2,5,":");
- xianshi(2,6,szfen1); delay(1);
- xianshi(2,7,szfen2); delay(1);
- // LCD_write_english_string(2,8,":");
- xianshi(2,9,szmiao1); delay(1);
- xianshi(2,10,szmiao2); delay(1);
- // wendu();
-
- num1=kaig();
- if(num1==7) dingshi2(kaig());
- if(num1==1) dingshi1(kaig());
- if(shi1==szshi1&&shi2==szshi2&&fen1==szfen1&&fen2==szfen2&&miao1==szmiao1&&miao2==szmiao2) dd=1;
- if(s1==szshi1&&s2==szshi2&&f1==szfen1&&f2==szfen2&&m1==szm1&&m2==szmiao2) dd=1;
- }
-
- }
复制代码 |
|