tg12232b.lst
来自「STC51系列的源码」· LST 代码 · 共 667 行 · 第 1/3 页
LST
667 行
425 /********************************************************************************/
426 /* fun_name : LCDP_get_text_font() */
C51 COMPILER V8.02 TG12232B 09/26/2008 15:18:08 PAGE 8
427 /* version : v1.00 */
428 /* created : xillinx */
429 /* descript : 获取字符的点阵表数据 */
430 /********************************************************************************/
431 unsigned char * LCDP_get_text_font(unsigned char index)
432 { static unsigned char Font[0x6];
433 1 unsigned char i;
434 1 for(i=0;i<0x6;i++)
435 1 { Font[i]=lcd_ascii_txt[index][i];
436 2 }
437 1 return Font;
438 1 }
439
440 /********************************************************************************/
441 /* fun_name : LCDP_hard_reset() */
442 /* version : v1.00 */
443 /* created : xillinx */
444 /* descript : LCDP的硬件复位 */
445 /********************************************************************************/
446 void LCDP_hard_reset(void)
447 { c51_U07_latch&=0x7F; //* LCD 硬复位
448 1 c51_hc138_cs_keyw[0x0]=c51_U07_latch;
449 1 LCDP_delay();
450 1 c51_U07_latch|=0x80;
451 1 c51_hc138_cs_keyw[0x0]=c51_U07_latch;
452 1 LCDP_delay();
453 1 }
454
455 /********************************************************************************/
456 /* fun_name : LCDP_LED_open() */
457 /* version : v1.00 */
458 /* created : xillinx */
459 /* descript : LCDP的背光打开 */
460 /********************************************************************************/
461 void LCDP_LED_open(void)
462 { c51_U07_latch|=0x40; //* LCD背光打开
463 1 c51_hc138_cs_keyw[0x0]=c51_U07_latch;
464 1 }
465
466 /********************************************************************************/
467 /* fun_name : LCDP_LED_close() */
468 /* version : v1.00 */
469 /* created : xillinx */
470 /* descript : LCDP的背光关闭 */
471 /********************************************************************************/
472 #if 0
void LCDP_LED_close(void)
{ c51_U07_latch&=0xBF; //* LCD背光关闭
c51_hc138_cs_keyw[0x0]=c51_U07_latch;
}
#endif
478
479 /********************************************************************************/
480 /* fun_name : LCDP_module_initialize() */
481 /* version : v1.00 */
482 /* created : xillinx */
483 /* descript : LCDP模块初始化 */
484 /********************************************************************************/
485 void LCDP_module_initialize(void)
486 { LCDP_hard_reset();
487 1 LCDP_LED_open();
488 1 LCDP_write_command(LCD_RESET);
C51 COMPILER V8.02 TG12232B 09/26/2008 15:18:08 PAGE 9
489 1 LCDP_write_command(0xA0); //* 0xa0
490 1 LCDP_write_command(LCD_DUTY_32); //* 0xa9
491 1 LCDP_start_line(0x00); //* 0xc0+0x00
492 1 LCDP_write_command(LCD_DISP_ON); //* 0xaf
493 1 }
494
495 /********************************************************************************/
496 /* fun_name : LCDP_text_printf() */
497 /* version : v1.00 */
498 /* created : xillinx */
499 /* descript : 输出字符显示数据 */
500 /********************************************************************************/
501 void LCDP_text_printf(unsigned char x,unsigned char y,unsigned char * buffer)
502 { unsigned char *Text;
503 1 while(*buffer)
504 1 { Text=LCDP_get_text_font(LCDP_get_index(*buffer));
505 2 LCDP_display_text(x++,y,Text);
506 2 if( x==20)
507 2 { break;
508 3 }
509 2 buffer++;
510 2 }
511 1 }
512
513 /********************************************************************************/
514 /* fun_name : LCDP_get_hz16_font() */
515 /* version : v1.00 */
516 /* created : xillinx */
517 /* descript : 获取汉字显示区的地址 */
518 /********************************************************************************/
519 unsigned char * LCDP_get_hz16_font(unsigned char * hz16)
520 { unsigned char status;
521 1 unsigned char i;
522 1 for(i=0x0;i<0x10;i++)
523 1 { status=memcmp(rongyi_hz[i].Index,hz16,0x2);
524 2 if( status==0x0)
525 2 { break;
526 3 }
527 2 }
528 1 if( i>=0x10)
529 1 { return NULL;
530 2 }
531 1 else
532 1 { return rongyi_hz[i].Msk;
533 2 }
534 1 }
535
536 /********************************************************************************/
537 /* fun_name : LCDP_hz16_printf() */
538 /* version : v1.00 */
539 /* created : xillinx */
540 /* descript : 输出汉字显示数据 */
541 /********************************************************************************/
542 void LCDP_hz16_printf(unsigned char xpos,unsigned char ypos,unsigned char * buffer)
543 { unsigned char * mdata;
544 1 unsigned char * text;
545 1 mdata=buffer;
546 1 while(*mdata)
547 1 { text=LCDP_get_hz16_font(mdata);
548 2 LCDP_display_hz16x16(xpos++,ypos,text);
549 2 mdata+=0x2;
550 2 if( xpos==10)
C51 COMPILER V8.02 TG12232B 09/26/2008 15:18:08 PAGE 10
551 2 { break;
552 3 }
553 2 }
554 1 }
555
556 /********************************************************************************/
557 /* fun_name : LCDP_display_sheft_hz16x16() */
558 /* version : v1.00 */
559 /* created : xillinx */
560 /* descript : 汉字取模: 从左到右从上到下取模,低位在上,高位在下 */
561 /********************************************************************************/
562 void LCDP_display_sheft_hz16x16(
563 unsigned char sheft,
564 unsigned char xpos,
565 unsigned char ypos,
566 unsigned char *buffer)
567 { unsigned char * mdata;
568 1 unsigned char i,wr;
569 1 if(ypos>0x1)
570 1 { return;
571 2 }
572 1 mdata=buffer;
573 1 wr=(xpos<<0x4)+sheft;
574 1 LCDP_set_page((ypos<<0x1)+0x0);
575 1 for(i=0x0;i<0x10;i++)
576 1 { if(wr>=61)
577 2 { LCDP_set_column(wr-61);
578 3 LCDP_write_ram_data(0x1,*mdata++);
579 3 }
580 2 else
581 2 { LCDP_set_column(wr);
582 3 LCDP_write_ram_data(0x0,*mdata++);
583 3 }
584 2 wr++;
585 2 }
586 1 wr=(xpos<<0x4)+sheft;
587 1 LCDP_set_page((ypos<<0x1)+0x1);
588 1 for(i=0x0;i<0x10;i++)
589 1 { if(wr>=61)
590 2 { LCDP_set_column(wr-61);
591 3 LCDP_write_ram_data(0x1,*mdata++);
592 3 }
593 2 else
594 2 { LCDP_set_column(wr);
595 3 LCDP_write_ram_data(0x0,*mdata++);
596 3 }
597 2 wr++;
598 2 }
599 1 }
600
601 /********************************************************************************/
602 /* fun_name : LCDP_hz16_sheft_printf() */
603 /* version : v1.00 */
604 /* created : xillinx */
605 /* descript : 输出汉字显示数据 */
606 /********************************************************************************/
607 void LCDP_hz16_sheft_printf(unsigned char sheft,unsigned char xpos,unsigned char ypos,unsigned char * buff
-er)
608 { unsigned char * mdata;
609 1 unsigned char * text;
610 1 mdata=buffer;
611 1 while(*mdata)
C51 COMPILER V8.02 TG12232B 09/26/2008 15:18:08 PAGE 11
612 1 { text=LCDP_get_hz16_font(mdata);
613 2 LCDP_display_sheft_hz16x16(sheft, xpos++,ypos,text);
614 2 mdata+=0x2;
615 2 if( xpos==10)
616 2 { break;
617 3 }
618 2 }
619 1 }
620
621
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1356 ----
CONSTANT SIZE = 1209 ----
XDATA SIZE = 6 49
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?