key_check.h

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

H
510
字号


/* 
 void key_check(U8 key,U8 up_down)
 {
    U8 i;
  if((IOPIN0&(1<<21))==0)
     {
       key++;i=1;
       while(i==1) {if((IOPIN0&(1<<21))!=0) i=0;} 
      }
      
      
  if((IOPIN0&(1<<22))==0)
     {
       up_down--;i=1;
       while(i==1) {if((IOPIN0&(1<<21))!=0) i=0;} 
      }
      
      
   if((IOPIN0&(1<<23))==0)
     {
       up_down++;i=1;
       while(i==1) {if((IOPIN0&(1<<21))!=0) i=0;} 
      }
      
  }
 
*/

void time_change(void)
{
 U32 times,days,mms,show,key=0,i;
 U32 ye_ar,mon_th,da_y;
 U8 a,b,c,d,e,f,g,h,j,k,m,n,p,q;
 
 if((IOPIN0&(1<<21))==0)
     { CCR=0x00;
       key++;i=1;
       while(i==1) {if((IOPIN0&(1<<21))!=0) i=0;} 
     times=CTIME0;
     days=CTIME1;
     
     show=(days>>16)&0x0fff;
     a=show/1000;
     b=(show%1000/100); 
     c=show%1000%100/10; 
     d=show%1000%100%10;
     
     show=(days>>8)&0x0f;
     e=show/10;
     f=show%10;
     
     show=days&0x1f;
     g=show/10;
     h=show%10;
     
     show=(times>>16)&0x1f;
     j=show/10;
     k=show%10;
     
     show=(times>>8)&0x3f;
     m=show/10;
     n=show%10;
     
     show=times&0x3f;
     p=show/10;
     q=show%10;
       
     }
   

  while((key>0)&(key<15))
  {  
      
    if((IOPIN0&(1<<21))==0)
     {
       key++;i=1;
       while(i==1) {if((IOPIN0&(1<<21))!=0) i=0;} 
       DelayNS(5000);
      }
      

      switch(key)
      {
        case 1:{// show=(days>>16)&0x0fff; 
                 //LCD_show_timefy(a,0,8);
           
                 if((IOPIN0&(1<<22))==0)
                   {
                    a=1;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;} 
                     DelayNS(5000);
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                    a=2;i=1;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 
               
                 LCD_show_timefy(a,0,8);
                 
                 
                 break;}
                 
        case 2:{// show=(days>>16)&0x0fff;
                 LCD_show_time(a,0,8);                 
       //          LCD_show_timefy(show%1000/100,0,16);
                 
                 
                 if((IOPIN0&(1<<22))==0)
                   {if(b==0) b=0;
                    else b--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     b++;i=1;
                     if(b>9) b=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 
               
              
                 LCD_show_timefy(b,0,16);
                 break;}
                 
        case 3:{// show=(days>>16)&0x0fff;
                 LCD_show_time(b,0,16);
              //   LCD_show_timefy(show%1000%100/10,0,24);
                 
                 
                 if((IOPIN0&(1<<22))==0)
                   {if(c==0) c=0;
                    else  c--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;} 
                     DelayNS(5000);
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                    c++;i=1;
                    if(c>9) c=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 
                 
                 
                 LCD_show_timefy(c,0,24);
                 
                 
                 break;}
                 
        case 4:{ //show=(days>>16)&0x0fff;
                 LCD_show_time(c,0,24);
                 //LCD_show_timefy(show%1000%100%10,0,32);
                 
                  
                 if((IOPIN0&(1<<22))==0)
                   {if(d==0) d=0;
                    else d--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;} 
                     DelayNS(5000);
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                    d++;i=1;
                    if(d>9) d=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 
                
                 LCD_show_timefy(d,0,32);
                 
                 YEAR=a*1000+b*100+c*10+d;
                
                 break;}
                 
        case 5:{ //show=(days>>16)&0x0fff;
                 LCD_show_time (d,0,32);
                // show=(days>>8)&0x0f;
                if((IOPIN0&(1<<22))==0)
                   { e=0;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     e=1;i=1;
                   
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
              
                 LCD_show_timefy(e,0,56);break;}
                 
        case 6:{ //show=(days>>8)&0x0f;
                 LCD_show_time(e,0,56);
                 
                 if((IOPIN0&(1<<22))==0)
                   {if(f==0) f=0;
                    else f--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     f++;i=1;
                     if(f>9) f=9;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
              
                 LCD_show_timefy(f,0,64);
                 MONTH=e*10+f;
                 break;}
                 
        case 7:{ //show=(days>>8)&0x0f;
                 LCD_show_time(f,0,64);
                // show=days&0x1f;
                if((IOPIN0&(1<<22))==0)
                   {if(g==0) g=0;
                    else g--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }
                   
                 if((IOPIN0&(1<<23))==0)
                   {
                     g++;i=1;
                     if(g>3) g=3;
                     while(i==1) {if((IOPIN0&(1<<23))!=0) i=0;} 
                     DelayNS(5000);
                   }
                 LCD_show_timefy(g,0,88);break;}
                 
        case 8:{ //show=days&0x1f;
                 LCD_show_time(g,0,88);
                 if((IOPIN0&(1<<22))==0)
                   {if(h==0) h=0;
                    else h--;i=1;
                     while(i==1) {if((IOPIN0&(1<<22))!=0) i=0;}
                     DelayNS(5000); 
                   }

⌨️ 快捷键说明

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