TFTLCD Chinese character display

Source: Internet
Author: User
Preparations for displaying Chinese characters on TFTLCD: 1. Hardware platform: STM32 Development Board, TFTLCD Display Module 2. Code editing and compilation: Keil uVision43. Program download method: Use "mcuisp ", use the serial assistant to download the program to the development board. 4. The modulo tool: TFTLCD is used to display Chinese characters, as shown in figure

5. Hardware circuit design: LCD _LED corresponds to PC10;
LCD _CS corresponds to PC9;
LCD _ RS corresponds to PC8;
LCD _ WR corresponds to PC7;
LCD _ RD corresponds to PC6;
LCD _ D [17] corresponds to PB [];

Only the hardware schematic diagram is listed here. When displaying Chinese characters, TFTLCD is used. Here we will only explain how to display Chinese characters. Next we will introduce functions related to Chinese character display.

// Draw Point
// X, y: Coordinates
// POINT_COLOR: the color of the vertex.
Void LCD _DrawPoint)
{
LCD _SetCursor (x, y); // you can specify the cursor position.
LCD _WriteRAM_Prepare (); // start writing GRAM
LCD-> LCD _RAM = POINT_COLOR;
}
// Draw points on the LCD (x, y)
// Color: the color of the vertex.
Void LCD _Draw_Point)
{
2010temp;
Temp = POINT_COLOR;
POINT_COLOR = color;
LCD _DrawPoint (x, y );
POINT_COLOR = temp;
}

// Display a 16*16 Chinese character at the specified position
// (X, y): position where Chinese characters are displayed
// Index: The number of Chinese characters in the tfont array
// Color: the color of the Chinese character
//
Void LCD _Show_CH_Font16)
{      
U8 temp, t, t1;
2010y0 = y;
For (t = 0; t <32; t ++) // Each 16*16 Chinese character lattice contains 32 bytes
    {   
If (t <16) temp = tfont16 [index * 2] [t]; // The first 16 bytes
Else temp = tfont16 [index * 2 + 1] [T-16]; // The Last 16 bytes
For (t1 = 0; t1 <8; t1 ++)
{
If (temp & 0x80) LCD _Draw_Point (x, y, color); // draw a solid point
Else LCD _Draw_Point (x, y, BACK_COLOR); // draw a blank point (using the background color)
Temp <= 1;
Y ++;
If (y-y0) = 16)
{
Y = y0;
X ++;
Break;
}
}   
    }          
}
// Display a 24x24 Chinese character at the specified position
// (X, y): position where Chinese characters are displayed
// Index: The number of Chinese characters in the tfont array
// Color: the color of the Chinese character
Void LCD _Show_CH_Font24)
{      
U8 temp, t, t1;
2010y0 = y;
For (t = 0; t <72; t ++) // Each 24x24 Chinese character lattice contains 72 bytes
    {   
If (t <24) temp = tfont24 [index * 3] [t]; // The first 24 bytes
Else if (t <48) temp = tfont24 [index * 3 + 1] [T-24]; // contains 24 bytes
Else temp = tfont24 [index * 3 + 2] [T-48]; // The last 24 bytes
For (t1 = 0; t1 <8; t1 ++)
{
If (temp & 0x80) LCD _Draw_Point (x, y, color); // draw a solid point
Else LCD _Draw_Point (x, y, BACK_COLOR); // draw a blank point (using the background color)
Temp <= 1;
Y ++;
If (y-y0) = 24)
{
Y = y0;
X ++;
Break;
}
}   
    }          
}

Note: 1. This document saves the Chinese character after the modulo operation to the project using the header file, and then compiles and downloads it to the development board. The Chinese characters supported by this method are only those in the header file after MoD. 2. There is a correspondence between the function for displaying Chinese characters and the modulo method. The Function for displaying Chinese characters varies with the modulo method. In this article, there is a method for setting the modulo software, and the Chinese character display function below corresponds to the method for setting the modulo software.


TFTLCD Chinese character display

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.