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

📄 ex6-5.lst

📁 12864程序51单片机控制12864液晶(程序+仿真电路)
💻 LST
📖 第 1 页 / 共 4 页
字号:
 321          //char code int2char[]="0123456789";
 322          
 323          
 324          void initFlag(void)
 325          {
 326   1              P0 = 0xFF;                      // 输出端口初始化
 327   1              P2 = 0xFF;                      // 输出端口初始化
 328   1              P1 = 0xFF;                      // 输入端口初始化
 329   1              P3 = 0xFF;                      // 输入端口初始化               
 330   1          now.hour = 24;
 331   1          now.minute =00;
 332   1          now.second =00; 
 333   1      }
 334          /**************************************************/
 335          /***************检测忙****************************/
 336          /************************************************/
 337          void check_GLCD_busyflag(void)
 338          {
 339   1             unsigned char   x;
 340   1              GLCD_R_W=1;
 341   1              GLCD_D_I=0;
 342   1              GLCD_ENABLE=1;
 343   1              P2=0x00;
 344   1              do 
 345   1                      {
 346   2                      x=P2 && 128;
 347   2              } while(x);
 348   1                        GLCD_ENABLE=0;
 349   1              GLCD_D_I=1;
 350   1              GLCD_R_W=1;
 351   1      }
 352          /********************写命令**********************/
 353          void write_GLCD_command(unsigned command)
 354          {
 355   1                              GLCD_R_W = 0;
 356   1                      GLCD_D_I = 0;
 357   1                      GLCD_ENABLE=1;
 358   1                      P2=command;
 359   1                      GLCD_ENABLE=0;
 360   1                      GLCD_D_I=1;
 361   1                      GLCD_R_W=1;
 362   1                      check_GLCD_busyflag();   //检测忙
 363   1      }
 364          /********************写数据*********************/
C51 COMPILER V8.05a   EX6_5                                                                12/06/2007 16:28:35 PAGE 7   

 365          void write_GLCD_data(unsigned GLCDdata)
 366          {
 367   1                              GLCD_R_W=0;
 368   1                      GLCD_D_I=1;
 369   1                      GLCD_ENABLE=1;
 370   1                      P2=GLCDdata;
 371   1                      GLCD_ENABLE=0;
 372   1                      GLCD_D_I=0;
 373   1                      GLCD_R_W=1;
 374   1                      check_GLCD_busyflag(); //检测忙
 375   1      }
 376          /*********************清屏**********************/       
 377          void clear_GLCD()
 378          {
 379   1              int     i,j;
 380   1              GLCD_CS1=1;
 381   1              GLCD_CS2=1;
 382   1              write_GLCD_command(GLCD_ON);    
 383   1              write_GLCD_command(GLCD_START_LINE_0);
 384   1              for(i=0;i<8;i++)
 385   1              {
 386   2                      write_GLCD_command(SET_PAGE+i); 
 387   2                      write_GLCD_command(SET_Y_ADDRESS_0);    
 388   2                      for(j=0;j<64;j++)
 389   2                      write_GLCD_data(0);
 390   2              }               
 391   1      }
 392          /*******************显示一个圆形****************/
 393          void show_pattern(unsigned char page,unsigned char y,unsigned char *pattern,unsigned char len)
 394          {
 395   1              int i;
 396   1              write_GLCD_command(SET_PAGE+page);      
 397   1              write_GLCD_command(SET_Y_ADDRESS_0+y);  
 398   1              for(i=0;i<len;i++)
 399   1              {
 400   2                      write_GLCD_data(*pattern);
 401   2                      pattern++;
 402   2              }
 403   1      }
 404          /*********************显示一个字****************/
 405          void display_GLCD_data(unsigned char *p)
 406          {                       
 407   1                if (gx<64) 
 408   1                                      {
 409   2                              GLCD_CS1=1;
 410   2                              GLCD_CS2=0;
 411   2                              show_pattern(gy,gx,p,8);
 412   2                              show_pattern(gy,gx+8,p+8,8);
 413   2                              show_pattern(gy+1,gx,p+16,8);
 414   2                              show_pattern(gy+1,gx+8,p+24,8);
 415   2                              } 
 416   1                      else
 417   1                              {
 418   2                              GLCD_CS1=0;
 419   2                              GLCD_CS2=1;
 420   2                              show_pattern(gy,gx-64,p,8);
 421   2                                      //show_pattern(gy,gx-58,p+8,8);
 422   2                              show_pattern(gy,gx-56,p+8,8);
 423   2      
 424   2                              show_pattern(gy+1,gx-64,p+16,8);
 425   2                                      //show_pattern(gy+1,gx-58,p+24,8);
 426   2                              show_pattern(gy+1,gx-56,p+24,8);
C51 COMPILER V8.05a   EX6_5                                                                12/06/2007 16:28:35 PAGE 8   

 427   2                              }
 428   1              gx=gx+16;
 429   1      }
 430          /**********************显示一个字符串*************/
 431          void display_GLCD_string(unsigned char *p,int len)
 432          {
 433   1               int i;
 434   1                      for(i=0;i<len;i++)
 435   1                      display_GLCD_data((p+32*i));
 436   1      }
 437          /**********************显示一个数字(00-99)*********/
 438          void display_GLCD_numberAB(char number)
 439          {
 440   1              int x,y;
 441   1              x=number/10;
 442   1              y=number%10;
 443   1              display_GLCD_data(digit[x]);
*** WARNING C182 IN LINE 443 OF EX6-5.C: pointer to different objects
 444   1              display_GLCD_data(digit[y]);
*** WARNING C182 IN LINE 444 OF EX6-5.C: pointer to different objects
 445   1      }
 446          /**********************显示一个数字(0-9)*********/
 447          void display_GLCD_numberB(char number)
 448          {
 449   1               unsigned int x,y,z,j;          
 450   1              x=(number/1000)%10;
 451   1              y=(number/100)%10;
 452   1                      z=(number/10)%10;
 453   1                      j=number%10;
 454   1              display_GLCD_data(digit[x]);
*** WARNING C182 IN LINE 454 OF EX6-5.C: pointer to different objects
 455   1              display_GLCD_data(digit[y]);
*** WARNING C182 IN LINE 455 OF EX6-5.C: pointer to different objects
 456   1                      display_GLCD_data(digit[z]);
*** WARNING C182 IN LINE 456 OF EX6-5.C: pointer to different objects
 457   1              display_GLCD_data(digit[j]);
*** WARNING C182 IN LINE 457 OF EX6-5.C: pointer to different objects
 458   1      }
 459          /*******************坐标*************************/
 460          void gotoxy(unsigned x,unsigned y)
 461          {
 462   1              gy=y;
 463   1              gx=x;
 464   1      }
 465          /***************************************************************************/
 466          /********************显示时间**********************************************/
 467          void display_time(time dispaly_time)
 468          {
 469   1              gotoxy(0,4);
 470   1              display_GLCD_numberAB(dispaly_time.hour);
 471   1              display_GLCD_data(comma);
*** WARNING C182 IN LINE 471 OF EX6-5.C: pointer to different objects
 472   1              display_GLCD_numberAB(dispaly_time.minute);
 473   1              display_GLCD_data(comma);
*** WARNING C182 IN LINE 473 OF EX6-5.C: pointer to different objects
 474   1              display_GLCD_numberAB(dispaly_time.second);
 475   1      }
 476          /********************显示电机时间**********************************************/
 477          void display_time1(int F)
 478          {

⌨️ 快捷键说明

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