📄 at89c52+12232lcd.lst
字号:
304 1 uchar page=0; //page表示上下两页
305 1 bit window=0; //window表示左右两页
306 1 //putcharR //右边
307 1 //putcharL //左边
308 1
309 1 for (x=width;x>1;x--)
310 1 {
311 2 if (i>60) {window=1;address=i%61;}
312 2 else address=i;
313 2
314 2 if(layer==0) //显示一行八个字
315 2 {
316 3 SetPage(0,0);
317 3 SetAddress(address,address);
318 3 if(window==1)PutCharR(bmp[i]);
319 3 else PutCharL(bmp[i]);
320 3 SetPage(1,1);
321 3 SetAddress(address,address);
322 3 if(window==1)PutCharR(bmp[i+width]);
323 3 else PutCharL(bmp[i+width]);
324 3 }
325 2 else
326 2 { //显示第二行八个汉字
327 3 SetPage(2,2);
328 3 SetAddress(address,address);
329 3 if(window==1)PutCharR(bmp[i]);
330 3 else PutCharL(bmp[i]);
331 3 SetPage(3,3);
332 3 SetAddress(address,address);
333 3 if(window==1)PutCharR(bmp[i+width]);
334 3 else PutCharL(bmp[i+width]);
335 3 }
336 2 i++;
337 2
338 2 }
339 1 }
340
341
342 /*
343 --------------------------------------------------------------------------------
344
345 调用方式:void clrscr(void)
346 函数说明:清屏
347 --------------------------------------------------------------------------------
348 -*/
349 void clrscr(void)
350 {
351 1 uchar i,page;
352 1 for (page=0;page<4;page++)
353 1 {
354 2 SetPage(page,page);
355 2 SetAddress(0,0);
356 2 for (i=0;i<61;i++){PutCharR(0);PutCharL(0);}
357 2 }
358 1 }
359
360 //-----------------------------------------------------------
361 //图片显示
362 //采用字模2生成或字模3生成的都可以.
363 //-----------------------------------------------------------
364 void DrawBmp1(uint x_add, uchar width,uchar *bmp)
365 {
C51 COMPILER V8.08 AT89C52_12232LCD 08/05/2008 11:48:34 PAGE 7
366 1 uchar x,address,i=0; //address表示显存的物理地址
367 1 uchar page=0; //page表示上下两页
368 1 bit window=0; //window表示左右两页
369 1 //putcharR //右边
370 1 //putcharL //左边
371 1 for (x=width;x>1;x--)
372 1 {
373 2 if (x_add>60) {window=1;address=x_add%61;}
374 2 else address=x_add;
375 2
376 2
377 2 SetPage(0,0);
378 2 SetAddress(address,address);
379 2 if(window==1)PutCharR(bmp[i]);
380 2 else PutCharL(bmp[i]);
381 2 SetPage(1,1);
382 2 SetAddress(address,address);
383 2 if(window==1)PutCharR(bmp[i+width]);
384 2 else PutCharL(bmp[i+width]);
385 2
386 2
387 2 SetPage(2,2);
388 2 SetAddress(address,address);
389 2 if(window==1)PutCharR(bmp[i+width+width]);
390 2 else PutCharL(bmp[i+width+width]);
391 2 SetPage(3,3);
392 2 SetAddress(address,address);
393 2 if(window==1)PutCharR(bmp[i+width+width+width]);
394 2 else PutCharL(bmp[i+width+width+width]);
395 2 i++;
396 2 x_add++;
397 2
398 2 }
399 1 }
400
401 //---------------------------------------------------------------
402 //---------------------------------------------------------------
403 //采用zimo2 显示汉字,以汉字的显示方式
404 //void Draw_word(uchar d_where,uint x_add,bit layer,uchar width)
405 //d_where表示在码表中第几个汉字,x_add横坐标位置,layer显示的层, width显示的宽度。
406 //---------------------------------------------------------------
407
408
409 void Draw_word(uchar d_where,uint x_add,bit layer,uchar width)
410 {
411 1 uchar x,i=0,address; //address表示显存的物理地址
412 1 uchar page=0; //page表示上下两页
413 1 bit window=0; //window表示左右两页
414 1 //putcharR //右边
415 1 //putcharL //左边
416 1 d_where=d_where*32;
417 1
418 1 for (x=width;x>1;x--)
419 1 {
420 2 if (x_add>60) {window=1;address=x_add%61;}
421 2 else address=x_add;
422 2
423 2 if(layer==0) //显示第一行八个字
424 2 {
425 3
426 3 SetPage(0,0);
427 3 SetAddress(address,address);
C51 COMPILER V8.08 AT89C52_12232LCD 08/05/2008 11:48:34 PAGE 8
428 3 if(window==1)PutCharR(bmp001[d_where]);//右边
429 3 else PutCharL(bmp001[d_where]);//左边
430 3 SetPage(1,1);
431 3 SetAddress(address,address);
432 3 if(window==1)PutCharR(bmp001[d_where+width]);
433 3 else PutCharL(bmp001[d_where+width]);
434 3
435 3 }
436 2 else
437 2 { //显示第二行八个汉字
438 3 SetPage(2,2);
439 3 SetAddress(address,address);
440 3 if(window==1)PutCharR(bmp001[d_where]);//右边
441 3 else PutCharL(bmp001[d_where]);//左边
442 3 SetPage(3,3);
443 3 SetAddress(address,address);
444 3 if(window==1)PutCharR(bmp001[d_where+width]);
445 3 else PutCharL(bmp001[d_where+width]);
446 3
447 3 }
448 2 x_add++;
449 2 d_where++;
450 2 }
451 1 }
452 /*
453 //------------------------------------------------------------------
454 //字模2显示一个汉字
455 //纵向取模,字节倒序
456 void disp_one(bit top_low,bit widows,uchar address,uchar width,uchar*bmp)
457 {
458 if(top_low==0)
459 {
460 SetPage(0,0);
461 SetAddress(address,address);
462 if(window==1)PutCharR(bmp001[next][i]);
463 else PutCharL(bmp001[next][i]);
464 SetPage(1,1);
465 SetAddress(address,address);
466 if(window==1)PutCharR(bmp001[next][i+width]);
467 else PutCharL(bmp001[next][i+width]);
468 }
469 else
470 {
471 SetPage(0,0);
472 SetAddress(address,address);
473 if(window==1)PutCharR(bmp001[next][i]);
474 else PutCharL(bmp001[next][i]);
475 SetPage(1,1);
476 SetAddress(address,address);
477 if(window==1)PutCharR(bmp001[next][i+width]);
478 else PutCharL(bmp001[next][i+width]);
479 }
480 }
481 */
482
483
484 //液晶显示规则
485 // M(左) S(右)
486 // page page
487 // 0 | 0
488 // 1 | 1
489 // 2 | 2
C51 COMPILER V8.08 AT89C52_12232LCD 08/05/2008 11:48:34 PAGE 9
490 // 3 | 3
491
492 void delay1s(uchar i)
493 {
494 1 while(i>1)
495 1 {
496 2 i--;
497 2
498 2 delay(65530);
499 2 }
500 1 }
501
502 //显示动态的等待图标
503 void wait1(unsigned char i)
504 {
505 1 for(;i>1;i--)
506 1 {delay1s(2);
507 2 clrscr(); //
508 2 DrawBmp1(0,60,Bmptc); //
509 2 DrawBmp1(76,19,Bmpt1); //
510 2 delay1s(2);
511 2 clrscr(); //
512 2 DrawBmp1(0,60,Bmptc); //
513 2 DrawBmp1(76,19,Bmpt2); //
514 2 delay1s(2);
515 2 clrscr(); //
516 2 DrawBmp1(0,60,Bmptc); //
517 2 DrawBmp1(76,19,Bmpt3); //
518 2 delay1s(2);
519 2 clrscr(); //
520 2 DrawBmp1(0,60,Bmptc); //
521 2 DrawBmp1(76,19,Bmpt4); //
522 2 delay1s(2);
523 2 clrscr(); //
524 2 DrawBmp1(0,60,Bmptc); //
525 2 DrawBmp1(76,19,Bmpt5); //
526 2 delay1s(2);
527 2 clrscr(); //
528 2 DrawBmp1(0,60,Bmptc); //
529 2 DrawBmp1(76,19,Bmpt6); //
530 2 delay1s(2);
531 2 clrscr(); //
532 2 DrawBmp1(0,60,Bmptc); //
533 2 DrawBmp1(76,19,Bmpt7); //
534 2 }
535 1
536 1 }
537
538
539 //演示程序
540 void main()
541 {
542 1
543 1 LCDINI(); //reset
544 1 clrscr(); //clr
545 1
546 1
547 1
548 1
549 1
550 1 Draw_word(0,0,0,16);
551 1
C51 COMPILER V8.08 AT89C52_12232LCD 08/05/2008 11:48:34 PAGE 10
552 1 Draw_word(1,16,0,16);
553 1
554 1 Draw_word(2,32,0,16); //
555 1 Draw_word(3,48,0,16); //
556 1 Draw_word(0,64,0,16); //
557 1 Draw_word(1,80,0,16); //
558 1 Draw_word(2,96,0,16); //
559 1
560 1 DrawBmp(1,120,Bmp002); //
561 1 clrscr(); //
562 1 delay1s(3);
563 1 DrawBmp1(0,122,Bmp012); //LOGO
564 1 while(1)
565 1 {
566 2 delay1s(3);
567 2
568 2 clrscr(); //
569 2 DrawBmp1(10,101,Bmp07); //
570 2
571 2 delay1s(8);
572 2 clrscr(); //
573 2 wait1(3);
574 2 DrawBmp1(0,122,Bmp04); //
575 2 delay1s(8);
576 2 clrscr(); //
577 2 wait1(3);
578 2 DrawBmp1(0,122,Bmp03); //超前科技
579 2 delay1s(8);
580 2 clrscr(); //
581 2 wait1(3);
582 2 clrscr(); //
583 2 DrawBmp1(10,101,Bmp05); //
584 2 delay1s(8);
585 2 clrscr(); //
586 2 wait1(3);
587 2 clrscr(); //
588 2 DrawBmp1(10,101,Bmp06); //
589 2 delay1s(8);
590 2 clrscr(); //
591 2 wait1(3);
592 2 clrscr(); //
593 2 DrawBmp1(10,101,Bmp08); //
594 2 delay1s(8);
595 2 clrscr(); //
596 2 wait1(3);
597 2 clrscr(); //
598 2 DrawBmp1(0,122,Bmp01); //这仿真器真不错,用过都说好.
599 2 wait1(8);
600 2 }
601 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1615 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 26
IDATA SIZE = ---- ----
BIT SIZE = ---- 5
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -