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

📄 12.c

📁 该程序是用C编写的
💻 C
字号:
asm(".include hardware.inc");
extern int Sec;
extern int Min;
extern int Hour;
extern int day;
extern int month;
extern int year;
extern int Tabel[10];
extern int keycode;
extern int i3;
extern int i5;


 
 
void display1 (void)
{  
  int temp; 
  while(1)
   {asm("[P_Watchdog_Clear]=%0"::"r"(0x0001));
     if(keycode==8)keycode=0,display2(); 
     if(i3==1) key_change(); 
     if(i5==1) irq_change();
    
     
     temp=Sec%10;
     temp=Tabel[temp];
     temp|=0x0700;
     asm("[P_IOB_Data]=%0"::"r"(temp));
     Delay1();
     
     temp=Sec/10;
     temp=Tabel[temp];
     temp|=0x0600;
     asm("[P_IOB_Data]=%0"::"r"(temp));
     Delay1();
     
     temp=Min%10;
     temp=Tabel[temp]; 
     temp|=0x0500;
     temp|=0x0080;
     
     asm("[P_IOB_Data]=%0"::"r"(temp));
     Delay1();

     temp=Min/10;
     temp=Tabel[temp];
     temp|=0x0400;
     asm("[P_IOB_Data]=%0"::"r"(temp));
     Delay1();
     
     temp=Hour%10;
     temp=Tabel[temp];
     temp|=0x0300;
     temp|=0x0080;
     asm("[P_IOB_Data]=%0"::"r"(temp));
     Delay1();
     
     temp=Hour/10;
     temp=Tabel[temp];
     temp|=0x0200;
     asm("[P_IOB_Data]=%0"::"r"(temp));
     
     Delay1();
     }
  }

     
void display2(void){
   int temp;
   while(1){
   asm("[P_Watchdog_Clear]=%0"::"r"(0x0001));
   if(keycode==8)keycode=0,display1();
   if(i3==1) key_change(); 
   if(i5==1) irq_change(); 
  
   
   temp=day%10;
   temp=Tabel[temp];
   temp|=0x0700;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
   
   temp=day/10;
   temp=Tabel[temp];
   temp|=0x0600;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
     
   temp=month%10;
   temp=Tabel[temp]; 
   temp|=0x0500;
   temp|=0x0080;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();

   temp=month/10;
   temp=Tabel[temp];
   temp|=0x0400;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
   
   temp=year/1000;
   temp=Tabel[temp];
   temp|=0x0000;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
   
   temp=year/100-(year/1000)*10;
   temp=Tabel[temp];                           
   temp|=0x0100;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
   
   temp=((year-year%10)/10)%10;
   temp=Tabel[temp];
   temp|=0x0200;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
   
   temp=year%10;
   temp=Tabel[temp];
   temp|=0x0300;
   temp|=0x0080;
   asm("[P_IOB_Data]=%0"::"r"(temp));
   Delay2();
    }
} 
void Delay1(void)
{int i=0;
 for(;i<190;){i++;}
 return;}
void Delay2(void)
{int i=0;
 for(;i<190;){i++;}
 return;
 }

⌨️ 快捷键说明

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