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

📄 timer.lst

📁 Vx1828点3.5"TFT屏的的源程序
💻 LST
📖 第 1 页 / 共 4 页
字号:
 461   3                                      shi_sub_write(EEPROM, 0x20, 0, &on_time.hour);DelayXms(0x30);
 462   3                                      write_timer(0x02, &on_time);
 463   3                                      break;
 464   3                              case 4:
 465   3                                      read_timer(0x02,&on_time);
 466   3                                      if(on_time.minute==0){
 467   4                                              on_time.minute=60;
 468   4                                              }
 469   3                                      on_time.minute--;
 470   3                                      on_time_menu(on_time.hour, on_time.minute);
 471   3                                      shi_sub_write(EEPROM, 0x21, 0, &on_time.minute);DelayXms(0x30);
 472   3                                      write_timer(0x02,&on_time);
 473   3                                      break;
 474   3                              case 5:
 475   3                                      timer_able_flag=~timer_able_flag;
 476   3                                      able_time_menu(timer_able_flag);
 477   3                                      shi_sub_write(EEPROM, 0x24, 0, &timer_able_flag);DelayXms(0x30);
 478   3                                      break;
 479   3                              case 6:
 480   3                                      read_timer(0x03,&off_time);
 481   3                                      if(off_time.hour==0){
 482   4                                              off_time.hour=24;
 483   4                                      }
 484   3                                      off_time.hour--;
 485   3                                      off_time_menu(off_time.hour, off_time.minute);
 486   3                                      shi_sub_write(EEPROM, 0x22, 0, &off_time.hour);DelayXms(0x30);
 487   3                                      write_timer(0x03, &off_time);
 488   3                                      break;
C51 COMPILER V7.50   TIMER                                                                 01/14/2006 15:30:04 PAGE 9   

 489   3                              case 7:
 490   3                                      read_timer(0x03,&off_time);
 491   3                                      if(off_time.minute==0){
 492   4                                              off_time.minute=60;
 493   4                                      }
 494   3                                      off_time.minute--;
 495   3                                      off_time_menu(off_time.hour, off_time.minute);
 496   3                                      shi_sub_write(EEPROM, 0x23, 0, &off_time.minute);DelayXms(0x30);
 497   3                                      write_timer(0x03, &off_time);
 498   3                                      break;
 499   3                              case 8:
 500   3                                      timer_able_flag=~timer_able_flag;
 501   3                                      able_time_menu(timer_able_flag);
 502   3                                      shi_sub_write(EEPROM, 0x24, 0, &timer_able_flag);DelayXms(0x30);
 503   3                                      write_timer(0x03, &off_time);
 504   3                                      break;
 505   3                              case 9:
 506   3                                       
 507   3                                      break;
 508   3                              default:
 509   3                                      break;
 510   3                      }
 511   2              }
 512   1      
 513   1              if(timemenu_flag&&irright_flag){
 514   2                      irright_flag=0;
 515   2                      switch (time_sel){
 516   3                              case 1:
 517   3                                      read_timer(0x01,&curr_time);
 518   3                                      curr_time.hour++;
 519   3                                      if(curr_time.hour==24){
 520   4                                              curr_time.hour=0;
 521   4                                      }                               
 522   3                                      current_time_menu(curr_time.hour, curr_time.minute,curr_time.second);
 523   3                                      //write to timer chip
 524   3                                      
 525   3                                      //temp[0]=curr_time.hour;
 526   3                                      //read_timer(&curr_time);
 527   3                                      //curr_time.hour=temp[0];
 528   3                                      write_timer(1,&curr_time);      
 529   3                                      
 530   3                                      break;
 531   3                              case 2:
 532   3                                      read_timer(0x01,&curr_time);
 533   3                                      curr_time.minute++;
 534   3                                      if(curr_time.minute==60){
 535   4                                              curr_time.minute=0;
 536   4                                      }
 537   3                                      current_time_menu(curr_time.hour, curr_time.minute,curr_time.second);
 538   3                                      //write to timer chip
 539   3                                      //temp[1]=curr_time.minute;
 540   3                                      //read_timer(&curr_time);
 541   3                                      //curr_time.minute=temp[0];
 542   3                                      write_timer(0x01,&curr_time);
 543   3                                      
 544   3                                      break;
 545   3                              case 3:
 546   3                                      read_timer(0x02,&on_time);
 547   3                                      on_time.hour++;
 548   3                                      if(on_time.hour==24){
 549   4                                              on_time.hour=0;
 550   4                                              }
C51 COMPILER V7.50   TIMER                                                                 01/14/2006 15:30:04 PAGE 10  

 551   3                                      on_time_menu(on_time.hour, on_time.minute);
 552   3                                      shi_sub_write(EEPROM, 0x20, 0, &on_time.hour);DelayXms(0x30);
 553   3                                      write_timer(0x02, &on_time);
 554   3                                      break;
 555   3                              case 4:
 556   3                                      read_timer(0x02,&on_time);
 557   3                                      on_time.minute++;
 558   3                                      if(on_time.minute==60){
 559   4                                              on_time.minute=0;
 560   4                                              }
 561   3                                      on_time_menu(on_time.hour, on_time.minute);
 562   3                                      shi_sub_write(EEPROM, 0x21, 0, &on_time.minute);DelayXms(0x30);
 563   3                                      write_timer(0x02, &on_time);
 564   3                                      break;
 565   3                              case 5:
 566   3                                      timer_able_flag=~timer_able_flag;
 567   3                                      able_time_menu(timer_able_flag);
 568   3                                      shi_sub_write(EEPROM, 0x24, 0, &timer_able_flag);DelayXms(0x30);
 569   3                                      break;
 570   3                              case 6:
 571   3                                      read_timer(0x03,&off_time);
 572   3                                      off_time.hour++;
 573   3                                      if(off_time.hour==24){
 574   4                                              off_time.hour=0;
 575   4                                              }
 576   3                                      off_time_menu(off_time.hour, off_time.minute);
 577   3                                      shi_sub_write(EEPROM, 0x22, 0, &off_time.hour);DelayXms(0x30);
 578   3                                      write_timer(0x03, &off_time);
 579   3                                      break;
 580   3                              case 7:
 581   3                                      read_timer(0x03,&off_time);
 582   3                                      off_time.minute++;
 583   3                                      if(off_time.minute==60){
 584   4                                              off_time.minute=0;
 585   4                                              }
 586   3                                      off_time_menu(off_time.hour, off_time.minute);
 587   3                                      shi_sub_write(EEPROM, 0x23, 0, &off_time.minute);DelayXms(0x30);
 588   3                                      write_timer(0x03, &off_time);
 589   3                                      break;
 590   3                              case 8:
 591   3                                      timer_able_flag=~timer_able_flag;
 592   3                                      able_time_menu(timer_able_flag);
 593   3                                      shi_sub_write(EEPROM, 0x24, 0, &timer_able_flag);DelayXms(0x30);
 594   3                                      break;
 595   3                              case 9:
 596   3                                      break;
 597   3                              default:
 598   3                                      break;
 599   3                      }
 600   2              }               
 601   1              //====== when timer open ,we must do so.
 602   1              
 603   1              
 604   1              
 605   1      }
 606          #endif
 607          void timer_on_off(void)//zl.d 1.5
 608          
 609          {
 610   1              shi_sub_read(EEPROM, 0x24, 0, &timer_able_flag);
 611   1              //printf("EEPROM, 0x24, 0, &timer_able_flag%bx\n",timer_able_flag);
 612   1              
C51 COMPILER V7.50   TIMER                                                                 01/14/2006 15:30:04 PAGE 11  

 613   1              if (timer_able_flag)
 614   1              {
 615   2                      if(!ptime_int1&ptime_int2)//pown on
 616   2                              {
 617   3                              
 618   3                              DelayXms(250);
 619   3      //////////////////////////////////////////////////////////////////
 620   3                              if(!ptime_int1&ptime_int2)//0n
 621   3                                      {
 622   4                                      unsigned char temp;
 623   4                                      if(!power_flag)
 624   4                                              {
 625   5                                                      printf("ptime_int1=0ptime_int2=1\n");
 626   5                                      
 627   5                                                      osd_timer=0;TR0=1;
 628   5                                                      printf("the key is power.\n");
 629   5                                                      irpower_flag = 1;       // IR Power Button Active
 630   5                                                      XIE_Power=0;
 631   5                                                      osd_timer=0;TR0=1;
 632   5                                                      shi_sub_read1(0x62, 00, &temp);
 633   5                                                      temp=temp&0xfb;
 634   5                                                      //temp=temp+0x60;//set int2 is high
 635   5                                                      shi_sub_write1(0x62, 00, &temp);
 636   5                                              }
 637   4                                      else 
 638   4                                              {
 639   5                                                      shi_sub_read1(0x62, 00, &temp);
 640   5                                                      temp=temp&0xfb;
 641   5                                                      //temp=temp+0x60;//set int2 is high
 642   5                                                      shi_sub_write1(0x62, 00, &temp);
 643   5                                              
 644   5                                              }
 645   4                                      
 646   4                                      
 647   4                                      }
 648   3      
 649   3      
 650   3                              
 651   3                              }
 652   2      //////////////////////////////////////////////////////////////////
 653   2                      if(!ptime_int2&ptime_int1)//0ff
 654   2                              {
 655   3                              DelayXms(250);
 656   3                              if(!ptime_int2&ptime_int1)
 657   3                                      {
 658   4                                              unsigned char  temp;
 659   4                                      if(power_flag)
 660   4                                              {
 661   5                                                      printf("ptime_int1=1ptime_int2=0\n");
 662   5                                      
 663   5                                                      osd_timer=0;TR0=1;
 664   5                                                      printf("the key is power.\n");
 665   5                                                      irpower_flag = 1;       // IR Power Button Active
 666   5                                                      XIE_Power=0;
 667   5                                                      osd_timer=0;TR0=1;
 668   5                                                      shi_sub_read1(0x62, 00, &temp);
 669   5                                                      temp=temp&0xbf;
 670   5                                                      //temp=temp+0x60;//set int2 is high
 671   5                                                      shi_sub_write1(0x62, 00, &temp);
 672   5      
 673   5                                              
 674   5                                              }
C51 COMPILER V7.50   TIMER                                                                 01/14/2006 15:30:04 PAGE 12  

 675   4                                      else
 676   4                                              {
 677   5                                                      shi_sub_read1(0x62, 00, &temp);
 678   5                                                      temp=temp&0xbf;
 679   5                                                      //temp=temp+0x60;//set int2 is high
 680   5                                                      shi_sub_write1(0x62, 00, &temp);
 681   5      
 682   5                                              
 683   5                                              }
 684   4                                      
 685   4                                      
 686   4                                      }
 687   3                              
 688   3                              }
 689   2      /////////////////////////////////////////////////////////////////
 690   2              }
 691   1      
 692   1      }
 693          /////////////////////////////////////////////////////////////////
 694          void read_timer(char temp1,struct TIME *time)//read timer  zl.d

⌨️ 快捷键说明

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