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

📄 da1302.lst

📁 利用实时时钟芯片DS1302设计的实时时钟
💻 LST
📖 第 1 页 / 共 4 页
字号:
 465   3                               }
 466   2        /*******************************Exit显示闪烁控制********************/
 467   2      
 468   2                        if((id==9)&&(a==1))               //id为8时exit闪烁
 469   2                               {OutputInformation(11,1,0x20);     //不显示
 470   3                        OutputInformation(12,1,0x20);     //不显示
 471   3                            OutputInformation(13,1,0x20);     //不显示
 472   3                                OutputInformation(14,1,0x20);     //不显示
 473   3                           }
 474   2                        else
 475   2                            DisplayListChar(11,1,exit);       //显示exit
 476   2                      }
 477   1      }
 478          /***************************************modelo为2时date闪烁***********************************************
             -/
 479          void model2()
 480          {
 481   1                if(id==0)
 482   1                 {OutputInformation(9,1,0x20);        //不显示
 483   2                  OutputInformation(4,1,0x20);        //不显示
 484   2                      OutputInformation(15,1,0x20);       //不显示
 485   2                      DisplayListChar(0,1,TIMER);             //显示time    
 486   2                  DisplayListChar(10,1,alarmclock);   //显示clock
 487   2                  if(a==1)
C51 COMPILER V8.08   DA1302                                                                09/16/2008 21:50:25 PAGE 9   

 488   2                       {OutputInformation(5,1,0x20);     //不显示
 489   3                    OutputInformation(6,1,0x20);     //不显示
 490   3                        OutputInformation(7,1,0x20);     //不显示
 491   3                        OutputInformation(8,1,0x20);     //不显示
 492   3                       }
 493   2                       
 494   2                 else
 495   2                   DisplayListChar(5,1,DATE);         //显示date
 496   2                 }
 497   1      /*****************************************************************************************************/
 498   1                                                              //id不为零时、进入日期调整
 499   1      /*****************************************************************************************************/
 500   1                else                                                          
 501   1                 { OutputInformation(0,1,0x20);                  //不显示
 502   2                       OutputInformation(11,1,0x20);                 //不显示
 503   2                   OutputInformation(3,1,0x2f);                  //显示固定字符 "/"
 504   2               OutputInformation(6,1,0x2f);                  //显示固定字符 "/"
 505   2               OutputInformation(9,1,0x2f);                  //显示固定字符 "/"  
 506   2         /****************************年显示闪烁控制********************/
 507   2                       if((id==1)&&(a==1))                                               //id为1时年闪烁
 508   2                    {
 509   3                         OutputInformation(1,1,0x20);                //不显示
 510   3                         OutputInformation(2,1,0x20);                //不显示
 511   3                        }
 512   2                       else
 513   2                        {OutputInformation(1,1,R1302(0x8d)/16+0x30); //显示年
 514   3                 OutputInformation(2,1,R1302(0x8d)%16+0x30); 
 515   3                        }
 516   2         /***************************月闪烁控制************************/
 517   2                       if((id==2)&&(a==1))                                               //id为2时月闪烁
 518   2                    {
 519   3                         OutputInformation(4,1,0x20);                //不显示
 520   3                         OutputInformation(5,1,0x20);                //不显示
 521   3                        }
 522   2                       else
 523   2                        {OutputInformation(4,1,R1302(0x89)/16+0x30); //显示月
 524   3                 OutputInformation(5,1,R1302(0x89)%16+0x30); 
 525   3                        }
 526   2        /***************************日闪烁控制************************/
 527   2                       if((id==3)&&(a==1))                                               //id为2日闪烁
 528   2                    {
 529   3                         OutputInformation(7,1,0x20);                //不显示
 530   3                         OutputInformation(8,1,0x20);                //不显示
 531   3                        }
 532   2                       else
 533   2                        {OutputInformation(7,1,R1302(0x87)/16+0x30); //显示日
 534   3                 OutputInformation(8,1,R1302(0x87)%16+0x30); 
 535   3                        }
 536   2        /***************************星期闪烁控制*********************************/
 537   2                       if((id==4)&&(a==1))                                               //id为2时星期闪烁
 538   2                    {
 539   3                         OutputInformation(10,1,0x20);                //不显示
 540   3                        }
 541   2                       else
 542   2                        {OutputInformation(10,1,R1302(0x8b)%16+0x30); //显示星期
 543   3                        }
 544   2        /**************************exit闪烁控制*********************************/
 545   2                       if((id==5)&&(a==1))                                                //id为5时exit闪烁
 546   2                     { OutputInformation(12,1,0x20);     //不显示
 547   3                       OutputInformation(13,1,0x20);     //不显示
 548   3                           OutputInformation(14,1,0x20);     //不显示
 549   3                               OutputInformation(15,1,0x20);     //不显示
C51 COMPILER V8.08   DA1302                                                                09/16/2008 21:50:25 PAGE 10  

 550   3                           }
 551   2                       else
 552   2                         DisplayListChar(12,1,exit);                  //显示exit
 553   2                 }
 554   1      }
 555          /*********************************************************************************/
 556          
 557                                                                          /*model为3时进入闹铃项目
 558          
 559          /**********************************************************************************/
 560          void model3()
 561          {
 562   1            if(id==0) 
 563   1                 {OutputInformation(9,1,0x20);        //不显示
 564   2                  OutputInformation(4,1,0x20);        //不显示
 565   2                      OutputInformation(15,1,0x20);       //不显示
 566   2              DisplayListChar(0,1,TIMER);             //显示time 
 567   2                  DisplayListChar(5,1,DATE);          //显示date    
 568   2                  if(a==1)
 569   2                       { OutputInformation(10,1,0x20);     //不显示
 570   3                     OutputInformation(11,1,0x20);     //不显示
 571   3                         OutputInformation(12,1,0x20);     //不显示
 572   3                         OutputInformation(13,1,0x20);     //不显示
 573   3                         OutputInformation(14,1,0x20);
 574   3                       }
 575   2                  else
 576   2                   DisplayListChar(10,1,alarmclock);  //显示cloak
 577   2                 }
 578   1      
 579   1      /**************************id不为零进入闹铃设置显示********************/
 580   1               else
 581   1               {if(id==12)                                               //闹铃开关显示
 582   2                 {DisplayListChar(0,1,ClockSet);         //显示ClockSet
 583   3                      OutputInformation(8,1,0x20);
 584   3                      OutputInformation(13,1,0x20);
 585   3                      OutputInformation(14,1,0x20);
 586   3      /*****************************闹铃开关显示********************************/ 
 587   3                  if(a==1)                                                       //A为闪烁标志
 588   3                    {OutputInformation(10,1,0x20);     //不显示
 589   4                     OutputInformation(11,1,0x20);     //不显示
 590   4                         OutputInformation(12,1,0x20);     //不显示
 591   4                         OutputInformation(13,1,0x20);     //不显示
 592   4                        }     
 593   3                  else
 594   3                   {
 595   4                    if(R1302(0xc3)%16==0)            //闹铃寄存器的值是否为零(关)
 596   4                              {DisplayListChar(10,1,ClockOff);}//显示OFF
 597   4                        else
 598   4                          {OutputInformation(9,1,0x20);    //不显示
 599   5                               OutputInformation(12,1,0x20);   //不显示
 600   5                       OutputInformation(13,1,0x20);   //不显示
 601   5                           OutputInformation(14,1,0x20);   //不显示
 602   5                               OutputInformation(15,1,0x20);   //不显示
 603   5                               DisplayListChar(10,1,ClockOn);  //显示ON 
 604   5                              }
 605   4                       }
 606   3                 }
 607   2               else 
 608   2                 {DisplayListChar(0,1,alarmclock);   //显示clock
 609   3                  OutputInformation(8,1,0x3a);       //显示固定字符 ":"
 610   3                      OutputInformation(5,1,0x20);       //不显示
 611   3                      OutputInformation(11,1,0x20);      //不显示
C51 COMPILER V8.08   DA1302                                                                09/16/2008 21:50:25 PAGE 11  

 612   3      /**************************闹铃时闪烁显示**********************/                 
 613   3                  if((id==13)&&(a==1))                           //闹铃时闪烁
 614   3                        {
 615   4                         OutputInformation(6,1,0x20);
 616   4                         OutputInformation(7,1,0x20);
 617   4                        }
 618   3                      else
 619   3                        {OutputInformation(6,1,R1302(0xc5)/16+0x30); //显示闹铃时
 620   4                         OutputInformation(7,1,R1302(0xc5)%16+0x30); //显示闹铃时
 621   4                        }
 622   3      
 623   3      /**************************闹铃分闪烁显示*******************/
 624   3                      if((id==14)&&(a==1))               //闹铃分闪烁
 625   3                       {OutputInformation(9,1,0x20);     //不显示
 626   4                        OutputInformation(10,1,0x20);    //不显示
 627   4                        
 628   4                       }
 629   3                      else
 630   3                        {OutputInformation(9,1,R1302(0xc7)/16+0x30);  //显示闹铃分
 631   4                         OutputInformation(10,1,R1302(0xc7)%16+0x30); //显示闹铃分
 632   4                        }
 633   3      
 634   3      /************************exit闪烁显示***********************/
 635   3                      if((id==15)&&(a==1))                       //exie闪烁
 636   3                        {OutputInformation(12,1,0x20);   //不显示
 637   4                     OutputInformation(13,1,0x20);   //不显示
 638   4                         OutputInformation(14,1,0x20);   //不显示
 639   4                         OutputInformation(15,1,0x20);   //不显示
 640   4                        }
 641   3                      else
 642   3                        DisplayListChar(12,1,exit);      //显示exit                                                              
 643   3                 }
 644   2               }
 645   1      }
 646                                                                  
 647          /*********************************背光灯设置*****************************************/
 648          void model4()
 649          {
 650   1                if(id==0)                                                             //id为零未进入背光灯设置
 651   1                 {OutputInformation(10,1,0x20);       //不显示
 652   2                  OutputInformation(11,1,0x20);       //不显示
 653   2                  OutputInformation(4,1,0x20);        //不显示
 654   2                      DisplayListChar(5,1,reset);         //显示reset         
 655   2                      DisplayListChar(12,1,exit);         //显示exit
 656   2                      if(a==1)
 657   2                        {OutputInformation(0,1,0x20);     //不显示
 658   3                     OutputInformation(1,1,0x20);     //不显示
 659   3                         OutputInformation(2,1,0x20);     //不显示
 660   3                         OutputInformation(3,1,0x20);     //不显示
 661   3                         }
 662   2                      else
 663   2                DisplayListChar(0,1,lamp);        //显示lamp
 664   2                  }
 665   1               else                                                       //id不为零(10)进入背光灯时间设置
 666   1                 {DisplayListChar(0,1,lamp);          //显示lamp
 667   2                      DisplayListChar(4,1,set);           //显示set
 668   2                      DisplayListChar(9,1,sec);           //显示sec
 669   2                      DisplayListChar(12,1,exit);         //显示exit
 670   2                      if((id==10)&&(a==1))
 671   2                         {
 672   3                              OutputInformation(7,1,0x20);      //不显示               
 673   3                  OutputInformation(8,1,0x20);}
C51 COMPILER V8.08   DA1302                                                                09/16/2008 21:50:25 PAGE 12  

 674   2                      else
 675   2                        {
 676   3                         OutputInformation(7,1,R1302(0xc1)/16+0x30); //读出背光灯延时时间
 677   3                         OutputInformation(8,1,R1302(0xc1)%16+0x30);
 678   3                        }
 679   2                      if((id==11)&&(a==1))
 680   2                        {OutputInformation(12,1,0x20);     //不显示
 681   3                     OutputInformation(13,1,0x20);     //不显示
 682   3                         OutputInformation(14,1,0x20);     //不显示
 683   3                         OutputInformation(15,1,0x20);     //不显示
 684   3                        }
 685   2               }
 686   1      
 687   1      }
 688          /*********************************时间归零设置*****************************************/
 689          void model5()
 690          {       
 691   1              OutputInformation(4,1,0x20);        //不显示
 692   1                  OutputInformation(10,1,0x20);       //不显示
 693   1                      OutputInformation(11,1,0x20);       //不显示
 694   1                  DisplayListChar(0,1,lamp);          //显示lamp
 695   1                  DisplayListChar(12,1,exit);         //显示exit
 696   1                      if(a==1)
 697   1                       { OutputInformation(5,1,0x20);     //不显示
 698   2                     OutputInformation(6,1,0x20);     //不显示
 699   2                         OutputInformation(7,1,0x20);     //不显示

⌨️ 快捷键说明

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