📄 hdc1600.lst
字号:
452 * Character wrapping is allowed.
453 * *** REQUIRE AT LEAST ONE FONT SET (sysfont.h) included under this file ****
454 * Cartesian coordinates as (0,0) at the top left hand corner, (127,159) at the
455 * lower right hand corner, w/ CM50010ACT6_BO in a verticle manner (J1 pins 1-20 verticle,
456 * pin 1 upward)
457 *
458 * Arguments : 'x' 0....MAX_COL_PIXEL-1 is matrix position in horizontal direction (x-axis).
459 *
460 * 'y' 0....MAX_ROW_PIXEL-1 is matrix position in vertical direction (y-axis).
461 *
462 * '*pStr' pointer to an ASCII string in RAM, null terminated
463 * 'fontSpace' font spacing from 1 to 127
464 * 'color' 16-bit color possible
465 * Returns : none
466 * Notes :
467 * Example : ....
468 * char s[20];
469 * main()
470 * {
471 * cDispPixStrAt(0,20,s,1,RGB(31,0,0)); //Display the ASCII string in s[20]
472 * //at (x,y)=(0,20), font space = 1
473 * //color in red
474 * }
475 *********************************************************************************************************
476 */
477 #if PIXEL_FONT_EN
478 void cDispStrAt(INT8U x, INT8U y, char *pStr, INT8U fontSpace, INT16U color)
479 {
480 1 INT8U pixelByte,bit_idx, i; //loop counters
481 1 INT8U c,fwidth, fheight; //character, font width & height store
482 1
483 1 while (*pStr)
484 1 {
485 2 c = *pStr++ - 32;
486 2
487 2 fwidth = SYS_FNT[c].fontWidth;
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 9
488 2 fheight = 8;
489 2
490 2 if((x+fwidth)>MAX_COL_PIXEL) //character wrapping here
491 2 {
492 3 x=0;
493 3 y+=fheight;
494 3 }
495 2
496 2 if((y+fheight)>MAX_ROW_PIXEL) //check for y boundary
497 2 {
498 3 y=0;
499 3 }
500 2
501 2 for(i=0;i<fheight;i++)
502 2 {
503 3 pixelByte = SYS_FNT[c].fontBody[i];
504 3 for(bit_idx=0; bit_idx<fwidth; bit_idx++)
505 3 {
506 4 if((pixelByte)&(0x80>>bit_idx))
507 4 cDispSetPixel(x+bit_idx, y+i, color);
508 4 }
509 3 }
510 2
511 2 x = x+fwidth+fontSpace;
512 2 }
513 1
514 1 cDispRstArea(); //reset the display area for 128*160 after DispSetPixel()
515 1 }
516 #endif
517
518
519 /*
520 *********************************************************************************************************
521 * WRITE A PATTERN AT X, Y COORDINATES
522 *
523 * Description : This function writes a particular pattern of size patWidth and patHeight at a position
524 * defined by (x,y) following Cartesian coordinate system.
525 * Cartesian coordinates as (0,0) at the top left hand corner, (127,159) at the
526 * lower right hand corner, w/ CM50010ACT6_BO in a verticle manner
527 * (J1 pins 1-20 verticle, pin 1 upward)
528 * Arguments : 'x' 0....MAX_COL_PIXEL-1 is matrix position in horizontal direction (x-axis)
529 * 'y' 0....MAX_ROW_PIXEL-1 is matrix position in vertical direction (y-axis)
530 * '*pPat' pointer to pattern data
531 * 'color' color in 16-bit mode
532 * Returns : none
533 * Notes :
534 *********************************************************************************************************
535 */
536 void cDisprPatAt(INT8U x, INT8U y, INT16U *pPat)
537 {
538 1 INT16U col, row, pWidth, pHeight, pixel;
539 1
540 1 pWidth = pPat[0];
541 1 pHeight = pPat[1];
542 1
543 1 for(row=0;row<pHeight;row++)
544 1 {
545 2 for(col=0;col<pWidth;col++)
546 2 {
547 3 pixel = pPat[col+row*pWidth+2];
548 3 cDispSetPixel(col+x,row+y,pixel);
549 3 }
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 10
550 2 }
551 1 cDispRstArea(); //reset the display area for 128*160 after DispSetPixel()
552 1 }
553
554 /*
555 *********************************************************************************************************
556 * ADJUST BRIGHTNESS & CONSTRAST IN NORMAL DISPLAY MODE
557 *
558 * Description : This function updates the brightness & contrast control value in normal display mode
559 * Arguments : (INT8U) 'brightness' 0...255
560 * (INT8U) 'contrast' 0...63
561 * Returns : none
562 * Notes :
563 *********************************************************************************************************
564 */
565 void cDispSetQuali(INT8U brightness, INT8U contrast)
566 {
567 1 //brightness control in normal display mode
568 1 cDispWrCmd(CONTRAST_CONTROL1);
569 1 cDispWrCmd(brightness);
570 1 //contrast control in normal display mode
571 1 cDispWrCmd(CONTRAST_CONTROL3);
572 1 cDispWrCmd(contrast);
573 1
574 1 }
575
576 /*
577 *********************************************************************************************************
578 * LOW LEVEL PORT INITIALIZATION
579 *
580 * Description : This function performs low level port initialization
581 * Arguments : none
582 * Returns : none
583 * Notes : Hardware specific
584 *********************************************************************************************************
585 */
586 void cDispInitPort(void)
587 {
588 1 cDISP_CS = HIGH; //de-select the color LCD to start with
589 1 cDISP_A0 = HIGH;
590 1 cDISP_WR = HIGH;
591 1 cDISP_RD = HIGH;
592 1 cDISP_DATA = 0x00;
593 1
594 1 //Since the same PCB is used for JHD12864J LCD module as well, there are two gates for backlight control
595 1 //1. cDISP_BL_PWR = power supply controlled by IRLML6401TR
596 1 //2. cDISP_LM2665_SW = charge pump switch built-in the CM50010ACT6_BO module
597 1 cDISP_BL_PWR = LOW; //cDISP_BL_PWR=HIGH -> MOSFET turned ON forever thus cDISP_BL_PWR appears once
598 1 cDISP_LM2665_SW = HIGH; //cDISP_LM2665_SW=HIGH -> LM2665 turned OFF to trn off backlight
599 1 }
600
601 /*
602 *********************************************************************************************************
603 * LOW LEVEL COMMAND WRITE TO LCD
604 *
605 * Description : This function performs low level command write to LCD
606 * Arguments : (INT8U) 'cmd' is the command written to the LCD module
607 * Returns : none
608 * Notes : Hardware specific. Delay required for individual Fosc
609 *********************************************************************************************************
610 */
611 void cDispWrCmd(INT8U cmd)
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 11
612 {
613 1 cDISP_A0 = LOW; //A0 LOW for command
614 1 cDISP_CS = LOW;
615 1 cDISP_DATA = cmd;
616 1 cDISP_WR = LOW;
617 1 cDISP_WR = HIGH;
618 1 cDISP_CS = HIGH;
619 1 }
620 /*
621 *********************************************************************************************************
622 * LOW LEVEL DATA WRITE TO LCD
623 *
624 * Description : This function performs low level display data write to LCD
625 * Arguments : (INT8U) 'dat' is the data written to the LCD module
626 * Returns : none
627 * Notes : Hardware specific. Delay required for individual Fosc
628 *********************************************************************************************************
629 */
630 void cDispWrDat(INT8U dat)
631 {
632 1 cDISP_A0 = HIGH; //A0 HIGH for data
633 1 cDISP_CS = LOW;
634 1 cDISP_DATA = dat;
635 1 cDISP_WR = LOW;
636 1 cDISP_WR = HIGH;
637 1 cDISP_CS = HIGH;
638 1 }
639
640 /*
641 *********************************************************************************************************
642 * cDispBackLite
643 *
644 * Description : This function control the LCD backlight ENABLE -OR- DISABLE
645 * Arguments : 'BOOLEAN' ctrl ENABLE for backlight ON
646 * DISABLE for backlight OFF
647 *
648 * Returns : none
649 * Notes : Hardware specific.
650 *********************************************************************************************************
651 */
652 void cDispBackLite(BOOLEAN ctrl)
653 {
654 1 if (ctrl==ENABLE)
655 1 {
656 2 cDISP_LM2665_SW = LOW; //turn ON LM2665 thus turn ON the backlight
657 2 }
658 1 else
659 1 {
660 2 cDISP_LM2665_SW = HIGH; //else, turn off LM2665 and thus turn OFF the backlight
661 2 }
662 1 }
663
664
665
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 765 ----
CONSTANT SIZE = 855 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 39
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 12
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -