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

📄 clock.lst

📁 我做的畢業設計,用AT89S51 控制LCD1602作為顯示. DS1302時鐘芯片顯示時間,DS18B20測量溫度,還有4X4的鍵盤驅動.實現了一個計算功能.可以用PROTUES 仿真軟件仿真,當時
💻 LST
📖 第 1 页 / 共 3 页
字号:
 204   4                 TimeString[SECOND_H]=Key_temp+'0';GotoXY(12,1);LCD_send_data(TimeString[SECOND_H]);
 205   4               }
 206   3             GotoXY(12,1);
 207   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 208   3             GotoXY(12,1);
 209   3             Delay1ms(20);
 210   3                 BurstWrite1302_Flag=1;
 211   3            }
 212   2            break;
 213   2      case  MINUTE_ADJ_L:                    //分钟底位调整
 214   2            //display
 215   2                {
 216   3                   if((Key_temp>=0)&&(Key_temp<=9))
 217   3                               {
 218   4                      TimeString[MIN_L]=Key_temp+'0';GotoXY(10,1);LCD_send_data(TimeString[MIN_L]);
 219   4                   }  
 220   3                 GotoXY(10,1);
 221   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 222   3             GotoXY(10,1);
 223   3             Delay1ms(20);
 224   3                 BurstWrite1302_Flag=1;
 225   3                }
 226   2            break;
 227   2      case  MINUTE_ADJ_H:                     //分钟高位调整
 228   2            //display
 229   2                {
 230   3                if((Key_temp>=0)&&(Key_temp<=5))
 231   3                                  {
 232   4                            TimeString[MIN_H]=Key_temp+'0';GotoXY(9,1);LCD_send_data(TimeString[MIN_H]);
 233   4                                      }
 234   3      
 235   3             GotoXY(9,1);
 236   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
C51 COMPILER V7.50   CLOCK                                                                 04/09/2007 18:39:44 PAGE 5   

 237   3             GotoXY(9,1);
 238   3             Delay1ms(20);
 239   3                 BurstWrite1302_Flag=1;
 240   3                }
 241   2            break;
 242   2      case  HOUR_ADJ_L:                      //小时底位调整
 243   2            //display
 244   2                {
 245   3         
 246   3      
 247   3                               if((Key_temp>=0)&&(Key_temp<=9))
 248   3                                {
 249   4                         TimeString[HOUR_L]=Key_temp+'0';GotoXY(7,1);LCD_send_data(TimeString[HOUR_L]);
 250   4                     } 
 251   3             GotoXY(7,1);
 252   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 253   3             GotoXY(7,1);
 254   3             Delay1ms(20);
 255   3                 BurstWrite1302_Flag=1;
 256   3                }
 257   2            break; 
 258   2      case  HOUR_ADJ_H:                      //小时高位调整   
 259   2            //display
 260   2                {
 261   3          
 262   3                 /*switch(Key_temp)
 263   3                               {
 264   3                                case ZERO : TimeString[HOUR_H]=0+'0';GotoXY(6,1);LCD_send_data(TimeString[HOUR_H]); break;    
 265   3                                case ONE  : TimeString[HOUR_H]=1+'0';GotoXY(6,1);LCD_send_data(TimeString[HOUR_H]); break;          
 266   3                                case TWO  : TimeString[HOUR_H]=2+'0';GotoXY(6,1);LCD_send_data(TimeString[HOUR_H]); break;       
 267   3              
 268   3                                default :break;        
 269   3                                }*/
 270   3                                 if((Key_temp>=0)&&(Key_temp<=2))
 271   3                                  {
 272   4                              TimeString[HOUR_H]=Key_temp+'0';GotoXY(6,1);LCD_send_data(TimeString[HOUR_H]);
 273   4                                       }
 274   3      
 275   3             GotoXY(6,1);
 276   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 277   3             GotoXY(6,1);
 278   3             Delay1ms(20);
 279   3                 BurstWrite1302_Flag=1;
 280   3            }
 281   2            break; 
 282   2      case  DATA_ADJ_L:                      //日期底位调整
 283   2            //display
 284   2           {
 285   3                  if((TimeString[HOUR_H]-'0'>=2)&&(TimeString[HOUR_L]-'0'>=4))
 286   3                         {
 287   4                           State_ADJ=HOUR_ADJ_L;
 288   4                         }
 289   3               
 290   3                                 if((Key_temp>=0)&&(Key_temp<=9))
 291   3                                  {
 292   4                              DateString[DATA_L]=Key_temp+'0';GotoXY(13,0);LCD_send_data(DateString[DATA_L]);
 293   4                                       }
 294   3      
 295   3             GotoXY(13,0);
 296   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 297   3             GotoXY(13,0);
 298   3             Delay1ms(20);
C51 COMPILER V7.50   CLOCK                                                                 04/09/2007 18:39:44 PAGE 6   

 299   3                 BurstWrite1302_Flag=1;
 300   3            }
 301   2            break;
 302   2      case  DATA_ADJ_H:                     //日期高位调整     
 303   2            //display
 304   2           {
 305   3        
 306   3      
 307   3                                 if((Key_temp>=0)&&(Key_temp<=1))
 308   3                                  {
 309   4                        DateString[DATA_H]=Key_temp+'0';GotoXY(12,0);LCD_send_data(DateString[DATA_H]);
 310   4                                      }
 311   3      
 312   3             GotoXY(12,0);
 313   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 314   3             GotoXY(12,0);
 315   3             Delay1ms(20);
 316   3                 BurstWrite1302_Flag=1;
 317   3            }
 318   2            break;
 319   2      case  MONTH_ADJ_L:                   //月份底位调整
 320   2            //display
 321   2            {
 322   3       
 323   3      
 324   3                                 if((Key_temp>=0)&&(Key_temp<=9))
 325   3                                  {
 326   4                            DateString[MONTH_L]=Key_temp+'0';GotoXY(10,0);LCD_send_data(DateString[MONTH_L]);
 327   4                      } 
 328   3             GotoXY(10,0);
 329   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 330   3             GotoXY(10,0);
 331   3             Delay1ms(20);
 332   3                 BurstWrite1302_Flag=1;
 333   3            }
 334   2            break;
 335   2      case  MONTH_ADJ_H:                   //月份高位调整
 336   2            //display
 337   2             {
 338   3          
 339   3      
 340   3                                 if((Key_temp>=0)&&(Key_temp<=1))
 341   3                                  {
 342   4                            DateString[MONTH_H]=Key_temp+'0';GotoXY(9,0);LCD_send_data(DateString[MONTH_H]);
 343   4                                      }
 344   3      
 345   3             GotoXY(9,0);
 346   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 347   3             GotoXY(9,0);
 348   3             Delay1ms(20);
 349   3                 BurstWrite1302_Flag=1;
 350   3            }
 351   2            break;
 352   2      case  YEAR_ADJ_L:                    //年份底位调整
 353   2            //display
 354   2                {
 355   3           
 356   3         
 357   3                                 if((Key_temp>=0)&&(Key_temp<=9))
 358   3                                   {
 359   4                                    DateString[YEAR_L]=Key_temp+'0';GotoXY(7,0);LCD_send_data(DateString[YEAR_L]);
 360   4                                       }
C51 COMPILER V7.50   CLOCK                                                                 04/09/2007 18:39:44 PAGE 7   

 361   3             GotoXY(7,0);
 362   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 363   3             GotoXY(7,0);
 364   3             Delay1ms(20);
 365   3                 BurstWrite1302_Flag=1;
 366   3            }
 367   2            break;
 368   2      case  YEAR_ADJ_H:                    //年份高位调整
 369   2            //display
 370   2                {
 371   3         
 372   3         
 373   3                                 if((Key_temp>=0)&&(Key_temp<=9))
 374   3                                  {
 375   4                                      DateString[YEAR_H]=Key_temp+'0';GotoXY(6,0);LCD_send_data(DateString[YEAR_H]);
 376   4                                      }
 377   3             GotoXY(6,0);
 378   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 379   3             GotoXY(6,0);
 380   3             Delay1ms(20);
 381   3                 BurstWrite1302_Flag=1;
 382   3                 Call_Display_Adjust_ALARM_Time_Bit=1;
 383   3            }
 384   2            break;
 385   2      case ALARM_ADJ_SECOND_L:           //打玲时间秒底位调整  
 386   2            //display
 387   2                {
 388   3                 if(Call_Display_Adjust_ALARM_Time_Bit==1)
 389   3                  {
 390   4                   Call_Display_Adjust_ALARM_Time_Bit=0;
 391   4               Display_Adjust_ALARM_Time();
 392   4                       
 393   4                      }
 394   3       
 395   3           
 396   3                                 if((Key_temp>=0)&&(Key_temp<=9))
 397   3                                  {
 398   4                         Alarm_Ram[SECOND_L]=Key_temp+'0';GotoXY(11,1);LCD_send_data(Alarm_Ram[SECOND_L]);
 399   4                                      }
 400   3                 GotoXY(11,1);
 401   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 402   3             GotoXY(11,1);
 403   3             Delay1ms(20);
 404   3                 BurstWrite1302_Flag=1;
 405   3            }
 406   2           break;
 407   2      case ALARM_ADJ_SECOND_H:           //打玲时间秒高位调整    
 408   2            //display
 409   2                {
 410   3        
 411   3              
 412   3                                  if((Key_temp>=0)&&(Key_temp<=5))
 413   3                                      {
 414   4                                    Alarm_Ram[SECOND_H]=Key_temp+'0';GotoXY(10,1);LCD_send_data(Alarm_Ram[SECOND_H]);
 415   4                                       }
 416   3                 GotoXY(10,1);
 417   3                 LCD_send_command(LCD_DISPLAY_ON|LCD_CURSOR_ON|LCD_CURSOR_BLINK_ON);//光标闪烁
 418   3             GotoXY(10,1);
 419   3             Delay1ms(20);
 420   3                 BurstWrite1302_Flag=1;

⌨️ 快捷键说明

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