ex5-7.lst

来自「单片机实验代码包括A/D」· LST 代码 · 共 481 行 · 第 1/2 页

LST
481
字号
 227          {
 228          {0X00,0XFF,0X15,0X15,0X15,0X95,0X9F,0X10},
 229          {0X10,0X9F,0X95,0X15,0X15,0X15,0XFF,0X00},
 230          {0X00,0X3F,0X00,0X00,0X00,0X0F,0X0A,0X0A},
 231          {0X0A,0X0A,0X0F,0X00,0X20,0X20,0X1F,0X00}},
 232          //是
 233          {
 234          {0X40,0X40,0X40,0X5F,0X55,0X55,0X55,0XD5},
 235          {0X55,0X55,0X55,0X5F,0X40,0X60,0X40,0X00},
 236          {0X20,0X10,0X08,0X07,0X08,0X10,0X20,0X3F},
 237          {0X22,0X22,0X22,0X23,0X22,0X20,0X20,0X00}},
 238          //:
 239          {
 240          {0X00,0X00,0X00,0X00,0X00,0X00,0X10,0X38},
 241          {0X38,0X10,0X00,0X00,0X00,0X00,0X00,0X00},
C51 COMPILER V8.02   EX5_7                                                                 01/03/2008 21:05:34 PAGE 5   

 242          {0X00,0X00,0X00,0X00,0X00,0X00,0X02,0X07},
 243          {0X07,0X02,0X00,0X00,0X00,0X00,0X00,0X00}}};
 244           /* 时间延迟函数 */
 245          void delay(void)  {                  
 246   1        unsigned char i,j;                
 247   1           for (i=0;i<255;i++)
 248   1                for(j=0;j<255;j++)
 249   1                ;
 250   1      }
 251          void check_GLCD_busyflag(void)
 252          {
 253   1           unsigned char   x;
 254   1           GLCD_R_W=READ;
 255   1           GLCD_D_I=COMMAND;
 256   1           GLCD_ENABLE=ENABLE;
 257   1           P0=255;
 258   1           do {
 259   2                   x=P0 && 128;
 260   2           } while(x);
 261   1           GLCD_ENABLE=DISABLE;
 262   1           GLCD_D_I=1;
 263   1           GLCD_R_W=1;
 264   1      }
 265          void write_GLCD_command(unsigned command)
 266          {
 267   1           GLCD_R_W=WRITE;       // P2_6 = 0
 268   1           GLCD_D_I=COMMAND;     // P2_5 = 0
 269   1           GLCD_ENABLE=ENABLE;   // P2_7=1
 270   1           P0=command;           // 从 P0 送出 command
 271   1           GLCD_ENABLE=DISABLE;  // P2_7=0
 272   1           GLCD_D_I=1;           // P2_5 = 1
 273   1           GLCD_R_W=1;           // P2_6 = 1
 274   1      // 检查忙碌标记,直到绘图型LCD不忙碌时就返回
 275   1           check_GLCD_busyflag();
 276   1      }
 277          void write_GLCD_data(unsigned GLCDdata)
 278          {
 279   1           GLCD_R_W=WRITE;       // P2_6 = 0
 280   1           GLCD_D_I=DATA;        // P2_5 = 1
 281   1           GLCD_ENABLE=ENABLE;   // P2_7=1
 282   1           P0=GLCDdata;          // 从 P0 送出 数据
 283   1           GLCD_ENABLE=DISABLE;  // P2_7= 0
 284   1           GLCD_D_I=0;           // P2_5 = 0
 285   1           GLCD_R_W=1;           // P2_6 = 1
 286   1      // 检查忙碌标记,直到绘图型LCD不忙碌时就返回
 287   1           check_GLCD_busyflag();
 288   1      }
 289          void clear_GLCD()
 290          {
 291   1           int     i,j;
 292   1           GLCD_RESET=0;
 293   1           for(i=0;i<2;i++);
 294   1           GLCD_RESET=1;
 295   1           GLCD_CS1=1;
 296   1           GLCD_CS2=1;
 297   1           write_GLCD_command(GLCD_ON);
 298   1           write_GLCD_command(GLCD_START_LINE_0);
 299   1           for(i=0;i<8;i++)
 300   1           {
 301   2               write_GLCD_command(SET_PAGE+i);
 302   2               write_GLCD_command(SET_Y_ADDRESS_0);
 303   2               for(j=0;j<64;j++)
C51 COMPILER V8.02   EX5_7                                                                 01/03/2008 21:05:34 PAGE 6   

 304   2                   write_GLCD_data(0);
 305   2           }
 306   1      }
 307          void show_pattern(unsigned char page,unsigned char y,
 308                            unsigned char *pattern,unsigned char len)
 309          {
 310   1           int i;
 311   1           write_GLCD_command(SET_PAGE+page);
 312   1           write_GLCD_command(SET_Y_ADDRESS_0+y);
 313   1           for(i=0;i<len;i++)
 314   1           {
 315   2               write_GLCD_data(*pattern);
 316   2               pattern++;
 317   2           }
 318   1      }
 319          void clear_pattern(unsigned char page,unsigned char y,
 320                             unsigned char len)
 321          {
 322   1           int i;
 323   1           write_GLCD_command(SET_PAGE+page);
 324   1           write_GLCD_command(SET_Y_ADDRESS_0+y);
 325   1           for(i=0;i<len;i++)
 326   1               write_GLCD_data(CLEAR);
 327   1      }
 328          unsigned char read_GLCD_data(void)
 329          {
 330   1           unsigned char x;
 331   1           GLCD_D_I=DATA;
 332   1           GLCD_R_W=READ;
 333   1           GLCD_ENABLE=ENABLE;
 334   1           P0=255;
 335   1           x=P0;
 336   1           GLCD_ENABLE=DISABLE;
 337   1           GLCD_D_I=0;
 338   1           check_GLCD_busyflag();
 339   1           GLCD_D_I=DATA;
 340   1           GLCD_ENABLE=ENABLE;
 341   1           x=P0;
 342   1           GLCD_ENABLE=DISABLE;
 343   1           check_GLCD_busyflag();
 344   1           return x;
 345   1      }
 346          void putpixel(unsigned char x,unsigned char y)
 347          {
 348   1           unsigned char i=1,temp,page_no;
 349   1           if(x<64) {
 350   2                GLCD_CS1=0;
 351   2                GLCD_CS2=1;
 352   2           } else
 353   1           {
 354   2                GLCD_CS1=1;
 355   2                GLCD_CS2=0;
 356   2                x=x-64;
 357   2           }
 358   1           write_GLCD_command(SET_Y_ADDRESS_0+y);
 359   1           page_no=SET_PAGE+x/8;
 360   1           write_GLCD_command(page_no);
 361   1           temp=x%8;
 362   1           while(temp) {
 363   2                i=i*2;
 364   2                temp--;
 365   2           }
C51 COMPILER V8.02   EX5_7                                                                 01/03/2008 21:05:34 PAGE 7   

 366   1           temp=read_GLCD_data();
 367   1           i=i | temp;
 368   1           write_GLCD_command(page_no);
 369   1           write_GLCD_data(i);
 370   1      }       
 371          void display_GLCD_data(unsigned char *p)
 372          {
 373   1           if (gx<64) {
 374   2               GLCD_CS1=1;
 375   2               GLCD_CS2=0;
 376   2               show_pattern(gy,gx,p,8);
 377   2               show_pattern(gy,gx+8,p+8,8);
 378   2               show_pattern(gy+1,gx,p+16,8);
 379   2               show_pattern(gy+1,gx+8,p+24,8);
 380   2           } else
 381   1           {
 382   2             GLCD_CS1=0;
 383   2             GLCD_CS2=1;
 384   2             show_pattern(gy,gx-64,p,8);
 385   2             show_pattern(gy,gx-58,p+8,8);
 386   2             show_pattern(gy+1,gx-64,p+16,8);
 387   2             show_pattern(gy+1,gx-58,p+24,8);
 388   2           }
 389   1           gx=gx+16;
 390   1      }
 391          void display_GLCD_string(unsigned char *p,int len)
 392          {
 393   1           int i;
 394   1           for(i=0;i<len;i++)
 395   1               display_GLCD_data((p+32*i));
 396   1      }
 397          void display_GLCD_number(char number)
 398          {
 399   1           int x,y;
 400   1           x=number/10;
 401   1           y=number%10;
 402   1           display_GLCD_data(digit[x]);
*** WARNING C182 IN LINE 402 OF EX5-7.C: pointer to different objects
 403   1           display_GLCD_data(digit[y]);
*** WARNING C182 IN LINE 403 OF EX5-7.C: pointer to different objects
 404   1      }
 405          void gotoxy(unsigned x,unsigned y)
 406          {
 407   1           gy=y;
 408   1           gx=x;
 409   1      }
 410          void main (void)
 411          {
 412   1           unsigned char i=0;
 413   1           clear_GLCD();
 414   1           gotoxy(0,0);
 415   1           display_GLCD_string(token,7);    //显示 现在时间是:
*** WARNING C182 IN LINE 415 OF EX5-7.C: pointer to different objects
 416   1           now.hour=12;
 417   1           now.minute=30;
 418   1           now.second=0;
 419   1           gotoxy(0,4);
 420   1           display_GLCD_number(now.hour);   // 显示 12:00:00
 421   1           display_GLCD_data(comma);
*** WARNING C182 IN LINE 421 OF EX5-7.C: pointer to different objects
 422   1           display_GLCD_number(now.minute);
 423   1           display_GLCD_data(comma);
C51 COMPILER V8.02   EX5_7                                                                 01/03/2008 21:05:34 PAGE 8   

*** WARNING C182 IN LINE 423 OF EX5-7.C: pointer to different objects
 424   1           display_GLCD_number(now.second);
 425   1           today.year=5;
 426   1           today.month=9;
 427   1           today.day=1;
 428   1           gotoxy(0,6);
 429   1           display_GLCD_number(today.year);  // 显示 05/09/01
 430   1           display_GLCD_data(slash);
*** WARNING C182 IN LINE 430 OF EX5-7.C: pointer to different objects
 431   1           display_GLCD_number(today.month);
 432   1           display_GLCD_data(slash);
*** WARNING C182 IN LINE 432 OF EX5-7.C: pointer to different objects
 433   1           display_GLCD_number(today.day);
 434   1           while(1);                         /* 无穷循环 */
 435   1      }
 436          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    800    ----
   CONSTANT SIZE    =   1043    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     10      19
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  7 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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