屏幕显示中英文

1.字模软件取字符数据

2.字模显示函数

void dis_charater(uint32_t charater_lcd_Add,uint8_t *p_charater)
{
    #define WORD_WIDTH 16
    uint32_t *p = (uint32_t *)(charater_lcd_Add);
    printf("\ncharater test\n");
         uint8_t i,j;
         for(i=0;i<WORD_WIDTH;i++)
         {
             for(j=0;j<8;j++)
            {
                if((p_charater[2*i]<<j) & 0x80)
                {
                    printf("*");
                    *p = WHITE;
                }
                else
                {
                    printf(" ");
                    *p = BLACK;
                }
                p++;
            }
             for(j=0;j<8;j++)
            {
                if((p_charater[2*i+1]<<j) & 0x80)
                {
                    printf("*");
                    *p = WHITE;
                }
                else
                {
                    printf(" ");
                    *p = BLACK;
                }
                p++;
            }
            printf("\n");
            p += LCD_PIXEL_WIDTH - WORD_WIDTH;
         }
}
void dis_char_posicion(uint8_t lcd_x,uint8_t lcd_y,uint8_t *p_charater)
{
        dis_charater(LCD_LAYER2_Buffer_Adderess + (lcd_x*4*16)+(lcd_y*800*4*16),p_charater);
}

void dis_EN_charater(uint32_t charater_lcd_Add,uint8_t *p_charater)
{
    #define EN_WORD_WIDTH 16
    uint32_t *p = (uint32_t *)(charater_lcd_Add);
    printf("\nEN charater test\n");
         uint8_t i,j;
         for(i=0;i<EN_WORD_WIDTH;i++)
         {
             for(j=0;j<8;j++)
            {
                if((p_charater[i]<<j) & 0x80)
                {
                    printf("*");
                    *p = WHITE;
                }
                else
                {
                    printf(" ");
                    *p = BLACK;
                }
                p++;
            }
            printf("\n");
            p += LCD_PIXEL_WIDTH - 8;
         }
}
void dis_EN_char_posicion(uint8_t lcd_x,uint8_t lcd_y,uint8_t *p_charater)
{
        dis_EN_charater(LCD_LAYER2_Buffer_Adderess + (lcd_x*4*8)+(lcd_y*800*4*16),p_charater);
}

3.调用显示函数

    uint8_t charater0[] = {
0x00,0x04,0x27,0xC4,0x14,0x44,0x14,0x54,0x85,0x54,0x45,0x54,0x45,0x54,0x15,0x54,
0x15,0x54,0x25,0x54,0xE5,0x54,0x21,0x04,0x22,0x84,0x22,0x44,0x24,0x14,0x08,0x08};/*"测",0*/
    uint8_t charater1[] = {
0x00,0x28,0x20,0x24,0x10,0x24,0x10,0x20,0x07,0xFE,0x00,0x20,0xF0,0x20,0x17,0xE0,
0x11,0x20,0x11,0x10,0x11,0x10,0x15,0x10,0x19,0xCA,0x17,0x0A,0x02,0x06,0x00,0x02};/*"试",1*/
uint8_t charater2[] = {0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00};/*"A",0*/

    dis_char_posicion(24,15,charater0);
    dis_char_posicion(25,15,charater1);
    dis_EN_char_posicion(26,15,charater2);
    dis_EN_char_posicion(27,14,charater2);

4.显示结果

 

posted @ 2023-10-14 11:18  Yannnnnnn  阅读(23)  评论(0编辑  收藏  举报