[DemoCode下载] M051驱动LCD黑白屏显示汉字

[复制链接]
1098|3
 楼主| 小明的同学 发表于 2024-4-21 15:03 | 显示全部楼层 |阅读模式
示例代码是在Nuvoton的基础上添加LCD汉字显示功能NU-LB_004学习板。本规范旨在为客户提供参考设计想要在LCD上显示汉字的用户。目前,只有“”的字符新唐电子” 可以显示。如果要显示多个字符,客户需要生成一个16×16的字体库。16×16字体的生成是从左到右,然后从上到下。如果字符很少,你可以把它放在芯片闪存上。如果你有更多的角色,那就是建议将它们放在外部SPI闪存上。
EC_M051_Display_Chinese_Characters_On_LCD_V1.00.zip (490.02 KB, 下载次数: 1)
  1. /*---------------------------------------------------------------------------------------------------------*/
  2. /*                                                                                                         */
  3. /* Copyright(c) 2014 Nuvoton Technology Corp. All rights reserved.                                         */
  4. /*                                                                                                         */
  5. /*---------------------------------------------------------------------------------------------------------*/
  6. #include <stdio.h>
  7. #include "M051Series.h"
  8. #include "lcd_Driver.h"


  9. #define PLLCON_SETTING      CLK_PLLCON_50MHz_HXT
  10. #define PLL_CLOCK           50000000


  11. void SYS_Init(void)
  12. {
  13.     /*---------------------------------------------------------------------------------------------------------*/
  14.     /* Init System Clock                                                                                       */
  15.     /*---------------------------------------------------------------------------------------------------------*/

  16.     /* Enable Internal RC 22.1184MHz clock */
  17.     CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);

  18.     /* Waiting for Internal RC clock ready */
  19.     CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);

  20.     /* Switch HCLK clock source to Internal RC and HCLK source divide 1 */
  21.     CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));

  22.     /* Enable external XTAL 12MHz clock */
  23.     CLK_EnableXtalRC(CLK_PWRCON_XTL12M_EN_Msk);

  24.     /* Waiting for external XTAL clock ready */
  25.     CLK_WaitClockReady(CLK_CLKSTATUS_XTL12M_STB_Msk);

  26.     /* Set core clock as PLL_CLOCK from PLL */
  27.     CLK_SetCoreClock(PLL_CLOCK);

  28.     /* Enable IP clock */
  29.     CLK_EnableModuleClock(UART0_MODULE);

  30.     /* IP clock source */
  31.     CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UART_S_PLL, CLK_CLKDIV_UART(1));


  32.     /* Update System Core Clock */
  33.     /* User can use SystemCoreClockUpdate() to calculate PllClock, SystemCoreClock and CycylesPerUs automatically. */
  34.     //SystemCoreClockUpdate();
  35.     PllClock        = PLL_CLOCK;            // PLL
  36.     SystemCoreClock = PLL_CLOCK / 1;        // HCLK
  37.     CyclesPerUs     = PLL_CLOCK / 1000000;  // For SYS_SysTickDelay()

  38.     /*---------------------------------------------------------------------------------------------------------*/
  39.     /* Init I/O Multi-function                                                                                 */
  40.     /*---------------------------------------------------------------------------------------------------------*/

  41.     /* Set P3 multi-function pins for UART0 RXD and TXD.*/
  42.     SYS->P3_MFP = SYS_MFP_P30_RXD0 | SYS_MFP_P31_TXD0;



  43. }

  44. /*---------------------------------------------------------------------------------------------------------*/
  45. /* Init UART                                                                                               */
  46. /*---------------------------------------------------------------------------------------------------------*/
  47. void UART0_Init()
  48. {
  49.     /* Reset IP */
  50.     SYS_ResetModule(UART0_RST);

  51.     /* Configure UART0 and set UART0 Baudrate */
  52.     UART_Open(UART0, 115200);
  53. }


  54. /*---------------------------------------------------------------------------------------------------------*/
  55. /* MAIN function                                                                                           */
  56. /*---------------------------------------------------------------------------------------------------------*/

  57. int main(void)
  58. {

  59.     /* Unlock protected registers */
  60.     SYS_UnlockReg();

  61.     /* Init System, IP clock and multi-function I/O */
  62.     SYS_Init();

  63.     /* Lock protected registers */
  64.     SYS_LockReg();

  65.     /* Init UART0 for printf */
  66.     UART0_Init();

  67.     printf("LCD demo start.\n");
  68.     /*---------------------------------------------------------------------------------------------------------*/
  69.     /* Init LCD                                                                                */
  70.     /*---------------------------------------------------------------------------------------------------------*/
  71.     LCD_Init();
  72.     LCD_EnableBackLight();
  73.     LCD_ClearScreen();

  74.     LCD_Print(0, "This is LCD demo");

  75.     ShowChar(1, 4, 'N');
  76.     ShowChar(1, 5, 'u');
  77.     ShowChar(1, 6, 'v');
  78.     ShowChar(1, 7, 'o');
  79.     ShowChar(1, 8, 't');
  80.     ShowChar(1, 9, 'o');
  81.     ShowChar(1, 10, 'n');

  82.     ShowCharCH(2, 2, 0); //in the third row and third column of LCD show  '��'
  83.     ShowCharCH(2, 3, 1); //in the third row and fourth column of LCD show '��'
  84.     ShowCharCH(2, 4, 2); //in the third row and fifth column of LCD show  '��'
  85.     ShowCharCH(2, 5, 3); //in the third row and sexth column of LCD show  '��'


  86.     while (1);
  87. }






 楼主| 小明的同学 发表于 2024-4-21 15:04 | 显示全部楼层
  1. /**************************************************************************//**
  2. * [url=home.php?mod=space&uid=288409]@file[/url]     LCD_Driver.c
  3. * [url=home.php?mod=space&uid=895143]@version[/url]  V3.0
  4. * $Revision: 4 $
  5. * $Date: 19/06/20 10:49a $
  6. * [url=home.php?mod=space&uid=247401]@brief[/url]    M051 series LCD Module library source file
  7. *
  8. * @note
  9. * Copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
  10. *****************************************************************************/
  11. #include "M051Series.h"
  12. #include "LCD_Driver.h"

  13. extern  const char Ascii[];
  14. extern  const char CHCode[];
  15. /**
  16.   * @brief  For SPI write method
  17.   * @param  u32Data    Data will be written by SPI0
  18.   * [url=home.php?mod=space&uid=266161]@return[/url] None
  19.   */
  20. static __INLINE void SpiWrite(uint32_t u32Data)
  21. {
  22.     SPI0->TX0 = u32Data;
  23.     SPI0->CNTRL |= SPI_CNTRL_GO_BUSY_Msk;

  24.     while ((SPI0->CNTRL & SPI_CNTRL_GO_BUSY_Msk));

  25.     SPI0->CNTRL |= SPI_CNTRL_IF_Msk;
  26. }

  27. /**
  28.   * @brief  Use SPI0 interface to configure LCD module
  29.   * @param  None
  30.   * @return None
  31.   */
  32. void LCD_Init(void)
  33. {
  34.     /* Use SPI0 for LCD */
  35.     SYS->P1_MFP &= ~(SYS_MFP_P17_Msk | SYS_MFP_P16_Msk | SYS_MFP_P15_Msk | SYS_MFP_P14_Msk);
  36.     SYS->P1_MFP |= SYS_MFP_P17_SPICLK0 | SYS_MFP_P16_MISO_0 | SYS_MFP_P15_MOSI_0 | SYS_MFP_P14_SPISS0;

  37.     CLK->APBCLK |= CLK_APBCLK_SPI0_EN_Msk;

  38.     SYS->IPRSTC2 |= SYS_IPRSTC2_SPI0_RST_Msk;
  39.     SYS->IPRSTC2 &= (~SYS_IPRSTC2_SPI0_RST_Msk);

  40.     /* Initial SPI0 data format and SPI0 clock */
  41.     SPI0->CNTRL = SPI_CNTRL_CLKP_Msk | SPI_CNTRL_TX_NEG_Msk | (9 << SPI_CNTRL_TX_BIT_LEN_Pos);
  42.     SPI0->DIVIDER = ((12000000 / 2000000) >> 1) - 1;

  43.     /* Enable the automatic hardware slave select function. Select the SS pin and configure as low-active. */
  44.     SPI0->SSR = SPI_SSR_AUTOSS_Msk | SPI_SSR_SSR_Msk ;

  45.     // Set BR
  46.     SpiWrite(0xEB);

  47.     // Set PM
  48.     SpiWrite(0x81);
  49.     SpiWrite(0xA0);

  50.     SpiWrite(0xC0);

  51.     // Set Display Enable
  52.     SpiWrite(0xAF);
  53. }

  54. /**
  55.   * @brief Configure start address of LCD
  56.   * @param PA PA value for LCD
  57.   * @param CA CA value for LCD
  58.   * @return None
  59.   */
  60. static void SetPACA(uint8_t PA, uint8_t CA)
  61. {
  62.     // Set PA
  63.     SpiWrite(0xB0 | PA);

  64.     // Set CA MSB
  65.     SpiWrite(0x10 | (CA >> 4) & 0xF);

  66.     // Set CA LSB
  67.     SpiWrite(0x00 | (CA & 0xF));
  68. }

  69. /**
  70.   * @brief Show a char on LCD
  71.   * @param x X position
  72.   * @param y Y position
  73.   * @param ascii_word    ASCII character that will be shown on LCD
  74.   * @return None
  75.   */
  76. void ShowChar(uint8_t x, uint8_t y, uint8_t ascii_word)
  77. {
  78.     int i = 0, k = 0;
  79.     unsigned char temp;
  80.     k = (ascii_word - 32) * 16;

  81.     for (i = 0; i < 8; i++)
  82.     {
  83.         SetPACA((x * 2), (129 - (y * 8) - i));
  84.         temp = Ascii[k + i];
  85.         SpiWrite(0x100 | temp);
  86.     }

  87.     for (i = 0; i < 8; i++)
  88.     {
  89.         SetPACA((x * 2) + 1, (129 - (y * 8) - i));
  90.         temp = Ascii[k + i + 8];
  91.         SpiWrite(0x100 | temp);
  92.     }
  93. }


  94. /**
  95.   * @brief show 16��16 Chinese character on LCD
  96.   * @param x X position,x=0��1��2��4
  97.   * @param y Y position,y=0��1��2��4��5��6��7
  98.   * @param index    Chinese character library in CHCode array
  99.   * @return None
  100.   */

  101. void ShowCharCH(uint8_t x, uint8_t y, uint16_t index)
  102. {
  103.     int i = 0, k = 0;
  104.     unsigned char temp;

  105.     k = index * 32;

  106.     /*Display 8��16 points in the upper half*/
  107.     for (i = 0; i < 16; i++)
  108.     {
  109.         SetPACA((x * 2), (129 - (y * 16) - i));
  110.         temp = CHCode[k + i];
  111.         SpiWrite(0x100 | temp);
  112.     }

  113.     /*Show 8��16 points in the lower half*/
  114.     for (i = 0; i < 16; i++)
  115.     {
  116.         SetPACA((x * 2) + 1, (129 - (y * 16) - i));
  117.         temp = CHCode[k + i + 16];
  118.         SpiWrite(0x100 | temp);
  119.     }
  120. }
  121. /**
  122.   * @brief Enable back-light of LCD
  123.   * @param None
  124.   * @return None
  125.   */
  126. void LCD_EnableBackLight(void)
  127. {
  128.     GPIO_SetMode(P1, 0x02, GPIO_PMD_OUTPUT);
  129.     P11 = 0;
  130. }

  131. /**
  132.   * @brief Disable back-light of LCD
  133.   * @param None
  134.   * @return None
  135.   */
  136. void LCD_DisableBackLight(void)
  137. {
  138.     GPIO_SetMode(P1, 0x02, GPIO_PMD_OUTPUT);
  139.     P11 = 1;
  140. }

  141. /**
  142.   * @brief Show a string on specific line
  143.   * @param line Line number
  144.   * @param str string
  145.   * @return None
  146.   */
  147. void LCD_Print(uint8_t line, char *str)
  148. {
  149.     int i = 0;

  150.     do
  151.     {
  152.         ShowChar(line, i, *str++);
  153.         i++;

  154.         if (i > 15)
  155.             break;
  156.     } while (*str != '\0');
  157. }

  158. /**
  159.   * @brief Clear screen to background color
  160.   * @param None
  161.   * @return None
  162.   */
  163. void LCD_ClearScreen(void)
  164. {
  165.     int i = 0;
  166.     /*CLEAR ALL PANEL*/
  167.     SetPACA(0x0, 0x0);

  168.     for (i = 0; i < 132 * 8; i++)
  169.     {
  170.         SpiWrite(0x100);
  171.     }

  172.     SpiWrite(0x10f);
  173. }


 楼主| 小明的同学 发表于 2024-4-21 15:04 | 显示全部楼层
  1. /**************************************************************************//**
  2. * @file     Ascii_Table.c
  3. * @version  V3.0
  4. * $Revision: 2 $
  5. * $Date: 14/01/21 5:25p $
  6. * @brief    ASCII mapping table
  7. *
  8. * @note
  9. * Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved.
  10. *
  11. ******************************************************************************/
  12. #include <stdio.h>
  13. const char Ascii[] =
  14. {
  15.     /*   */
  16.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  17.     ,
  18.     /* ! */
  19.     0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  20.     /* " */
  21.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00,
  22.     /* # */
  23.     0x00, 0x00, 0x00, 0xC0, 0x30, 0xC0, 0x30, 0x00, 0xC8, 0x39, 0xCF, 0x39, 0x0F, 0x09, 0x01, 0x00,
  24.     /* $ */
  25.     0xE0, 0x10, 0x10, 0xF8, 0x10, 0x10, 0x60, 0x00, 0x30, 0x41, 0x42, 0xFF, 0x42, 0x44, 0x38, 0x00,
  26.     /* % */
  27.     0xC0, 0x20, 0x10, 0xE0, 0x20, 0xE0, 0x18, 0x00, 0x01, 0xC2, 0x31, 0x0C, 0x73, 0x88, 0x44, 0x38
  28.     ,
  29.     /* & */
  30.     0x00, 0xE0, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x78, 0x85, 0x82, 0x8D, 0x70, 0xA2, 0x9E, 0x42
  31.     ,
  32.     /* ' */
  33.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  34.     ,
  35.     /* ( */
  36.     0xC0, 0x30, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
  37.     ,
  38.     /* ) */
  39.     0x04, 0x08, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x1F, 0x00, 0x00, 0x00, 0x00
  40.     ,
  41.     /* * */
  42.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0xFE, 0x28, 0x44, 0x00, 0x00, 0x00
  43.     ,
  44.     /* + */
  45.     0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0xFF, 0x08, 0x08, 0x08, 0x00,
  46.     /* , */
  47.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  48.     ,
  49.     /* - */
  50.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00
  51.     ,
  52.     /* . */
  53.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  54.     ,
  55.     /* / */
  56.     0x00, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
  57.     ,
  58.     /* 0 */
  59.     0xC0, 0x20, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x00, 0x3F, 0x40, 0x80, 0x80, 0x40, 0x3F, 0x00, 0x00,
  60.     /* 1 */
  61.     0x20, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  62.     /* 2 */
  63.     0x60, 0x10, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x00, 0xC0, 0xA0, 0x90, 0x88, 0x86, 0xC1, 0x00, 0x00
  64.     ,
  65.     /* 3 */
  66.     0x20, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x80, 0x80, 0x82, 0x83, 0x44, 0x38, 0x00, 0x00
  67.     ,
  68.     /* 4 */
  69.     0x00, 0x00, 0x80, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x18, 0x16, 0x11, 0x10, 0xFF, 0x10, 0x00, 0x00,
  70.     /* 5 */
  71.     0x00, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x80, 0x81, 0x81, 0x81, 0x42, 0x3C, 0x00, 0x00
  72.     ,
  73.     /* 6 */
  74.     0x80, 0x40, 0x20, 0x10, 0x10, 0x10, 0x00, 0x00, 0x3F, 0x42, 0x81, 0x81, 0x42, 0x3C, 0x00, 0x00
  75.     ,
  76.     /* 7 */
  77.     0x70, 0x10, 0x10, 0x10, 0x90, 0x70, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1C, 0x03, 0x00, 0x00, 0x00
  78.     ,
  79.     /* 8 */
  80.     0xC0, 0x20, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x00, 0x38, 0x45, 0x82, 0x82, 0x45, 0x38, 0x00, 0x00
  81.     ,
  82.     /* 9 */
  83.     0xC0, 0x20, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x00, 0x83, 0x84, 0x88, 0x48, 0x24, 0x1F, 0x00, 0x00
  84.     ,
  85.     /* : */
  86.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  87.     ,
  88.     /* ; */
  89.     0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  90.     ,
  91.     /* < */
  92.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x00, 0x00
  93.     ,
  94.     /* = */
  95.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88
  96.     ,
  97.     /* > */
  98.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00
  99.     ,
  100.     /* ? */
  101.     0xE0, 0x10, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x06, 0x01, 0x00, 0x00, 0x00
  102.     ,
  103.     /* [url=home.php?mod=space&uid=72445]@[/url] */
  104.     0xC0, 0x20, 0x10, 0x90, 0x90, 0x10, 0xA0, 0xC0, 0x3F, 0x40, 0x8F, 0x90, 0x90, 0x8F, 0x50, 0x5F,
  105.     /* A */
  106.     0x00, 0x00, 0x80, 0x70, 0x80, 0x00, 0x00, 0x00, 0x80, 0xF0, 0x8F, 0x08, 0x8F, 0xF0, 0x80, 0x00,
  107.     /* B */
  108.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x80, 0xFF, 0x82, 0x82, 0x82, 0x45, 0x38, 0x00,
  109.     /* C */
  110.     0xC0, 0x20, 0x10, 0x10, 0x10, 0x20, 0x70, 0x00, 0x3F, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x00
  111.     ,
  112.     /* D */
  113.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x60, 0x80, 0x00, 0x80, 0xFF, 0x80, 0x80, 0x80, 0x60, 0x1F, 0x00,
  114.     /* E */
  115.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, 0x80, 0xFF, 0x82, 0x82, 0x82, 0x87, 0xE0, 0x00,
  116.     /* F */
  117.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, 0x80, 0xFF, 0x82, 0x02, 0x02, 0x07, 0x00, 0x00,
  118.     /* G */
  119.     0xC0, 0x20, 0x10, 0x10, 0x20, 0x70, 0x00, 0x00, 0x3F, 0x40, 0x80, 0x80, 0x84, 0x7C, 0x04, 0x00
  120.     ,
  121.     /* H */
  122.     0x10, 0xF0, 0x10, 0x00, 0x10, 0xF0, 0x10, 0x00, 0x80, 0xFF, 0x82, 0x02, 0x82, 0xFF, 0x80, 0x00,
  123.     /* I */
  124.     0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  125.     /* J */
  126.     0x00, 0x00, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0x40, 0x80, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00,
  127.     /* K */
  128.     0x10, 0xF0, 0x10, 0x80, 0x50, 0x30, 0x10, 0x00, 0x80, 0xFF, 0x83, 0x0C, 0xB0, 0xC0, 0x80, 0x00,
  129.     /* L */
  130.     0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x80, 0x80, 0x80, 0xC0, 0x20, 0x00,
  131.     /* M */
  132.     0x10, 0xF0, 0x80, 0x00, 0x80, 0xF0, 0x10, 0x00, 0x80, 0xFF, 0x83, 0x3C, 0x83, 0xFF, 0x80, 0x00,
  133.     /* N */
  134.     0x10, 0xF0, 0xC0, 0x00, 0x10, 0xF0, 0x10, 0x00, 0x80, 0xFF, 0x80, 0x0F, 0x30, 0xFF, 0x00, 0x00,
  135.     /* O */
  136.     0x80, 0x60, 0x10, 0x10, 0x10, 0x60, 0x80, 0x00, 0x1F, 0x60, 0x80, 0x80, 0x80, 0x60, 0x1F, 0x00,
  137.     /* P */
  138.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x80, 0xFF, 0x84, 0x04, 0x04, 0x02, 0x01, 0x00,
  139.     /* Q */
  140.     0xE0, 0x18, 0x04, 0x04, 0x04, 0x18, 0xE0, 0x00, 0x07, 0x18, 0x20, 0x20, 0x60, 0x98, 0x87, 0x00
  141.     ,
  142.     /* R */
  143.     0x10, 0xF0, 0x10, 0x10, 0x10, 0x20, 0xC0, 0x00, 0x80, 0xFF, 0x84, 0x0C, 0x34, 0xC2, 0x81, 0x00,
  144.     /* S */
  145.     0xC0, 0x20, 0x10, 0x10, 0x10, 0x20, 0x70, 0x00, 0xE0, 0x41, 0x82, 0x82, 0x84, 0x48, 0x30, 0x00
  146.     ,
  147.     /* T */
  148.     0x30, 0x10, 0x10, 0xF0, 0x10, 0x10, 0x30, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x00, 0x00,
  149.     /* U */
  150.     0x10, 0xF0, 0x10, 0x00, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x7F, 0x80, 0x80, 0x80, 0x7F, 0x00, 0x00,
  151.     /* V */
  152.     0x10, 0xF0, 0x10, 0x00, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x01, 0x1E, 0xE0, 0x1E, 0x01, 0x00, 0x00,
  153.     /* W */
  154.     0x10, 0xF0, 0x10, 0xC0, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00,
  155.     /* X */
  156.     0x10, 0x70, 0x90, 0x00, 0x90, 0x70, 0x10, 0x00, 0x80, 0xE0, 0x99, 0x06, 0x99, 0xE0, 0x80, 0x00
  157.     ,
  158.     /* Y */
  159.     0x10, 0x70, 0x90, 0x00, 0x90, 0x70, 0x10, 0x00, 0x00, 0x00, 0x83, 0xFC, 0x83, 0x00, 0x00, 0x00
  160.     ,
  161.     /* Z */
  162.     0x70, 0x10, 0x10, 0x10, 0x10, 0xD0, 0x30, 0x00, 0xC0, 0xB0, 0x88, 0x86, 0x81, 0x80, 0xE0, 0x00
  163.     ,
  164.     /* [ */
  165.     0xFC, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  166.     /* \ */
  167.     0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00
  168.     ,
  169.     /* ] */
  170.     0x04, 0x04, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
  171.     /* ^ */
  172.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x18, 0x60, 0x80, 0x00
  173.     ,
  174.     /* _ */
  175.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
  176.     ,
  177.     /* ` */
  178.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00
  179.     ,
  180.     /* a */
  181.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x91, 0x89, 0x49, 0xFE, 0x80, 0x00, 0x00
  182.     ,
  183.     /* b */
  184.     0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x81, 0x81, 0x42, 0x3C, 0x00, 0x00,
  185.     /* c */
  186.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x81, 0x81, 0x81, 0x42, 0x00, 0x00
  187.     ,
  188.     /* d */
  189.     0x00, 0x00, 0x00, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x81, 0x81, 0x7F, 0x80, 0x00, 0x00,
  190.     /* e */
  191.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4A, 0x89, 0x89, 0x8A, 0x4C, 0x00, 0x00
  192.     ,
  193.     /* f */
  194.     0x00, 0x00, 0xE0, 0x10, 0x10, 0x20, 0x00, 0x00, 0x01, 0x81, 0xFF, 0x81, 0x01, 0x00, 0x00, 0x00,
  195.     /* g */
  196.     0x80, 0x40, 0x40, 0x40, 0x80, 0x40, 0x00, 0x00, 0x53, 0xAC, 0xA4, 0xA4, 0xA3, 0x40, 0x00, 0x00,
  197.     /* h */
  198.     0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x01, 0xFE, 0x80, 0x00, 0x00,
  199.     /* i */
  200.     0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  201.     /* j */
  202.     0x00, 0x00, 0x80, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00
  203.     ,
  204.     /* k */
  205.     0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x98, 0x25, 0xC3, 0x81, 0x00, 0x00,
  206.     /* l */
  207.     0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  208.     /* m */
  209.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x80, 0x00,
  210.     /* n */
  211.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFE, 0x01, 0x01, 0xFE, 0x80, 0x00, 0x00,
  212.     /* o */
  213.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x81, 0x81, 0x42, 0x3C, 0x00, 0x00
  214.     ,
  215.     /* p */
  216.     0x40, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xA0, 0x20, 0x10, 0x0F, 0x00, 0x00,
  217.     /* q */
  218.     0x00, 0x80, 0x40, 0x40, 0x80, 0x40, 0x00, 0x00, 0x0F, 0x10, 0x20, 0xA0, 0xFF, 0x80, 0x00, 0x00,
  219.     /* r */
  220.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFF, 0x82, 0x01, 0x01, 0x00, 0x00, 0x00,
  221.     /* s */
  222.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x49, 0x89, 0x91, 0x92, 0x67, 0x00, 0x00
  223.     ,
  224.     /* t */
  225.     0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x7F, 0x81, 0x81, 0x40, 0x00, 0x00
  226.     ,
  227.     /* u */
  228.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x80, 0x81, 0x7F, 0x80, 0x00, 0x00,
  229.     /* v */
  230.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x39, 0xC0, 0x39, 0x07, 0x01, 0x00
  231.     ,
  232.     /* w */
  233.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1F, 0xE1, 0x1C, 0xE1, 0x1F, 0x01, 0x00,
  234.     /* x */
  235.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xE7, 0x18, 0x18, 0xE7, 0x81, 0x00, 0x00
  236.     ,
  237.     /* y */
  238.     0x40, 0xC0, 0x40, 0x00, 0x40, 0xC0, 0x40, 0x00, 0x80, 0x81, 0x46, 0x38, 0x06, 0x01, 0x00, 0x00
  239.     ,
  240.     /* z */
  241.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xA1, 0x91, 0x89, 0x85, 0xC3, 0x00, 0x00
  242.     ,
  243.     /* { */
  244.     0x00, 0xF0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7D, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
  245.     ,
  246.     /* | */
  247.     0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  248.     /* } */
  249.     0x08, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00
  250.     ,
  251.     /* ~ */
  252.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20, 0x20, 0x60, 0xC0, 0x80, 0x80, 0x60
  253. };
 楼主| 小明的同学 发表于 2024-4-21 15:04 | 显示全部楼层
  1. /**************************************************************************//**
  2. * @file     lcd_driver.h
  3. * @version  V3.0
  4. * $Revision: 3 $
  5. * $Date: 19/06/20 10:49a $
  6. * @brief    M051 series LCD Module library header file
  7. *
  8. * @note
  9. * Copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
  10. *****************************************************************************/
  11. #ifndef __LCD_DRIVER_H__
  12. #define __LCD_DRIVER_H__

  13. extern void LCD_ClearScreen(void);
  14. extern void LCD_Print(uint8_t line, char *str);
  15. extern void LCD_EnableBackLight(void);
  16. extern void LCD_DisableBackLight(void);
  17. extern void LCD_Init(void);
  18. extern void ShowChar(uint8_t x, uint8_t y, uint8_t ascii_word);
  19. extern void ShowCharCH(uint8_t x, uint8_t y, uint16_t index);
  20. #endif /* __LCD_DRIVER_H__ */

  21. /*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
您需要登录后才可以回帖 登录 | 注册

本版积分规则

159

主题

1640

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部