DSP LCM uses Chinese characters and ANSI C characters to display[Copy link]
Chinese Character Display Chinese characters are generally displayed in a graphical manner. The dot matrix code of the Chinese characters to be displayed is extracted from the microcomputer in advance. Each Chinese character occupies 32 bytes, divided into two halves, 1, 3, 5... on the left, 2, 4, 6... on the right. According to the row and column numbers that start to be displayed on the LCD and the number of columns in each row, the corresponding address of the display RAM can be found, the cursor is set, the first byte of the Chinese character to be displayed is sent, the cursor position is increased by 1, the second byte is sent, the line is aligned by column, and the third byte is sent... until 32 bytes are displayed, a complete Chinese character can be obtained on the LCD. If you want to display a large number of Chinese characters in the program, do you have to take the modulus of all these characters? The answer is yes, but our predecessors have completed this step for us, made a database, and encoded it. As long as the library file is called according to the encoding rules, the required characters can be retrieved. Let's talk about the encoding rules: Each Chinese character is represented by two bytes, the first byte represents the area code, and the second byte represents the bit number, so the position of the Chinese character in the Chinese character database is: 94×(area code-1)+(bit number-1). 94 means that there are 94 Chinese characters in each area, minus 1 means that the array starts from 0, while the area code and bit number start from 1. To determine the position of a Chinese character in a database, you need to multiply it by the number of bytes occupied by a Chinese character font, that is, [94×(area code-1)+(bit number-1)]×the number of bytes occupied by a Chinese character font. For example, in a Song-style database with a font size of 16×16, the bytes occupied by each Chinese character in the database are 16×16÷8=32, so the position of each Chinese character in the Song-style database is: [94×(area code-1)+(bit number-1)]×32. The character call of ASCII code is simpler than that of Chinese characters. You only need to multiply it by the number of bytes occupied by the font to find the position of the character in the font. For example, in an 8×16 ASCII font, the position of the ASCII code in the font is ASCII×16. If Chinese characters and ASCII codes are mixed in the same, how to distinguish them? In fact, it is also very simple. The highest bit of the ASCII code is 0, while the highest bit of the Chinese code is 1. Therefore, when the highest bit of a byte read is 0, the byte is the ASCII code, and its next byte has nothing to do with this byte; when the highest bit of the byte obtained is 1, it represents a Chinese character, and this byte and its next byte are combined to represent a complete Chinese character. The encoding rules have been introduced, so how to open the font library? We can use the font library that has been made by our predecessors, and then open it like accessing a normal file. Another method is to transform the font library into a very large array, so that we can read the font library like operating an array (here, we use this method) ANSIC character display When using LCD to display a character, it is more complicated, because a character is composed of 6×8 or 8×8 dot matrix, that is, to find 8 bytes of display RAM area corresponding to certain positions on the screen, and to make different bits of each byte '1', and the others '0', '1' is lit, and '0' is dark, so that a certain character is formed. But for controllers with built-in character generators (such as T6963C), displaying characters is relatively simple. The controller can be made to work in text mode, find the corresponding address of the display RAM according to the row and column number and the number of columns in each row on the LCD, set the cursor, and send the code corresponding to the character here. A character occupies 8 bytes, each byte has 8 bits, corresponding to 8*8 pixels.