key_check.h

来自「LPC2132驱动128*64点阵液晶」· C头文件 代码 · 共 510 行 · 第 1/2 页

H
510
字号
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     h++;i=1;
                     if(h>9) h=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(h,0,96);
                 DOM=g*10+h;
                 break;}
                 
        case 9:{// show=days&0x1f;
                 LCD_show_time(h,0,96); 
                // show=(times>>16)&0x1f;
                if((IOPIN0&(1<<22))==0)
                   {if(j==0) j=0;
                    else j--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     j++;i=1;
                     if(j>2) j=2;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(j,4,32);break;}
                 
        case 10:{//show=(times>>16)&0x1f;
                 LCD_show_time(j,4,32);
                 if((IOPIN0&(1<<22))==0)
                   {if(k==0) k=0;
                    else k--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     k++;i=1;
                     if(k>9) k=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(k,4,40);
                 HOUR=j*10+k;
                 break;}
                 
        case 11:{//show=(times>>16)&0x1f;
                 LCD_show_time(k,4,40);
                // show=(times>>8)&0x3f;
                 if((IOPIN0&(1<<22))==0)
                   {if(m==0) m=0;
                    else m--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     m++;i=1;
                     if(m>5) m=5;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(m,4,56);break;}
                 
        case 12:{//show=(times>>8)&0x3f;
                 LCD_show_time(m,4,56);
                 if((IOPIN0&(1<<22))==0)
                   {if(n==0) n=0;
                    else n--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     n++;i=1;
                     if(n>9) n=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(n,4,64);
                 MIN=m*10+n;
                 break;}
                 
        case 13:{//show=(times>>8)&0x3f;
                 LCD_show_time(n,4,64);
                 //show=times&0x3f;  
                 if((IOPIN0&(1<<22))==0)
                   {if(p==0) p=0;
                    else p--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     p++;i=1;
                     if(p>5) p=5;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(p,4,80);break;}
                 
        case 14:{//show=times&0x3f; 
                 LCD_show_time(p,4,80); 
                  if((IOPIN0&(1<<22))==0)
                   {if(q==0) q=0;
                    else q--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     q++;i=1;
                     if(q>9) q=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(q,4,88);
                 SEC=p*10+q;
                 break;}
                 
     /*  case 15:{//show=times&0x3f;
                 LCD_show_time(q,4,88);
                 show=mms&0x0fff;
                 LCD_show_timefy(show/100,6,76);break;}
                 
        case 16:{show=mms&0x0fff;
                 LCD_show_time(show/100,6,76);
                 LCD_show_timefy(show%100/10,6,84);break;}
                 
        case 17:{show=mms&0x0fff;
                 LCD_show_time(show%100/10,6,84);
                 LCD_show_timefy(show%100%10,6,92);break;}
           
       */
       }
 //**************************************************************      
       //DOY=235;
       if((a*1000+b*100+c*10+d)%4==0)
           switch(e*10+f)
                 {
                   case 1:{DOY=g*10+h;break;}
                   case 2:{DOY=g*10+h+31;break;}
                   case 3:{DOY=g*10+h+60;break;}
                   case 4:{DOY=g*10+h+91;break;}
                   case 5:{DOY=g*10+h+121;break;}
                   case 6:{DOY=g*10+h+152;break;}
                   case 7:{DOY=g*10+h+182;break;}
                   case 8:{DOY=g*10+h+213;break;}
                   case 9:{DOY=g*10+h+244;break;}
                   case 10:{DOY=g*10+h+274;break;}
                   case 11:{DOY=g*10+h+305;break;}
                   case 12:{DOY=g*10+h+335;break;}
                 }
           
        
       if((a*1000+b*100+c*10+d)%4!=0)
            switch(e*10+f)
                 {
                   case 1:{DOY=g*10+h;break;}
                   case 2:{DOY=g*10+h+31;break;}
                   case 3:{DOY=g*10+h+59;break;}
                   case 4:{DOY=g*10+h+90;break;}
                   case 5:{DOY=g*10+h+120;break;}
                   case 6:{DOY=g*10+h+151;break;}
                   case 7:{DOY=g*10+h+181;break;}
                   case 8:{DOY=g*10+h+212;break;}
                   case 9:{DOY=g*10+h+243;break;}
                   case 10:{DOY=g*10+h+273;break;}
                   case 11:{DOY=g*10+h+304;break;}
                   case 12:{DOY=g*10+h+334;break;}
                 }
             
       
       mms=CTIME2;
       show=mms&0x0fff;
       LCD_show_time(show/100,6,76);
       LCD_show_time(show%100/10,6,84);
       LCD_show_time(show%100%10,6,92);
//***************************************************************
  //  if((a*1000+b*100+c*10+d)>=2000)
   //   {
       ye_ar=(a*1000+b*100+c*10+d-2000)/4;
       mon_th=(a*1000+b*100+c*10+d-2000)%4;
       switch(mon_th)
            {
              case 0:{da_y=ye_ar*1461+DOY;break;}
              case 1:{da_y=ye_ar*1461+DOY+366;break;}
              case 2:{da_y=ye_ar*1461+DOY+731;break;}
              case 3:{da_y=ye_ar*1461+DOY+1096;break;}
             }
             
        switch(da_y%7)
             {
               case 0:{DOW=5;LCD_show_word(29,2,72);break;}
               case 1:{DOW=6;LCD_show_word(31,2,72);break;}
               case 2:{DOW=7;LCD_show_word(15,2,72);break;}
               case 3:{DOW=1;LCD_show_word(21,2,72);break;}
               case 4:{DOW=2;LCD_show_word(23,2,72);break;}
               case 5:{DOW=3;LCD_show_word(25,2,72);break;}
               case 6:{DOW=4;LCD_show_word(27,2,72);break;}
             }  
   //    }
       
 /*    if((a*1000+b*100+c*10+d)<2000)
        {
       ye_ar=(2000-(a*1000+b*100+c*10+d))/4;
       mon_th=(2000-(a*1000+b*100+c*10+d))%4;
       switch(mon_th)
            {
              case 0:{da_y=ye_ar*1461+DOY;break;}
              case 1:{da_y=ye_ar*1461+DOY+366;break;}
              case 2:{da_y=ye_ar*1461+DOY+731;break;}
              case 3:{da_y=ye_ar*1461+DOY+1096;break;}
             }
             
        switch(da_y%7)
             {
               case 0:{DOW=5;LCD_show_word(29,2,72);break;}
               case 1:{DOW=6;LCD_show_word(31,2,72);break;}
               case 2:{DOW=7;LCD_show_word(15,2,72);break;}
               case 3:{DOW=1;LCD_show_word(21,2,72);break;}
               case 4:{DOW=2;LCD_show_word(23,2,72);break;}
               case 5:{DOW=3;LCD_show_word(25,2,72);break;}
               case 6:{DOW=4;LCD_show_word(27,2,72);break;}
             }  
       }
  */
//****************************************************************       
       
     }  

     CCR=0x01;
  
 } 
 
 

 
 
 
 
 
 
 
 
  

⌨️ 快捷键说明

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