Service Hotline
Aby wyświetlić znaki chińskie na monitorze lub drukarce, znaki chińskie są projektowane na matrycy punktowej zgodnie z symbolami graficznymi, a następnie uzyskiwany jest odpowiadający im kod matrycy punktowej (kod glifowy).
The unified encoding method used to represent Chinese characters in computers is called internal code (such as national standard code), and the internal code is unique (equivalent to the ID number of the character). The Chinese character encoding formed to facilitate the input of Chinese characters is an input code, which is an external code of Chinese characters. The input code is different due to different encoding methods and is diverse. The Chinese character code formed for displaying and printing out Chinese characters is a glyph code. The computer finds the glyph code of the Chinese character in the font model library through the Chinese character internal code and realizes its conversion.
Kod w aparacie
According to the provisions of the national standard code, each Chinese character has a certain binary code, but this code will conflict with the ASCII code when processed internally by the computer. To solve this problem, add 1 to the first byte of each byte of the national standard code. Since the ASCII code only uses 7 bits, the "1" in the first place can be used as a mark to identify Chinese character codes. When the computer processes the code with "1" in the first place, it understands it as Chinese character information, and when it processes the code with "0" in the first place, it understands it as an ASCII code. The national standard code (internal code) processed in this way is the internal code.
Jeśli zamienimy znak „.” w grafice „口” na „0”, możemy uzyskać bardzo wyraźny kod glifu „口”: 0000H 0004H 3FFAH 2004H 2004H 2004H 2004H 2004H 2004H 2004H 2004H 2004H2004H 3FFAH 2004H 0000H 0000H. Gdy komputer chce wyprowadzić „口”, najpierw znajduje pierwszy adres biblioteki czcionek wyświetlanych, oblicza na podstawie wewnętrznego kodu „口”, a następnie znajduje kod glifu „口”, a następnie sekwencyjnie skanuje ekran zgodnie z kodem glifu (w systemie binarnym) poprzez sterowanie generatorem znaków. Jeśli kod binarny to „0”, skanowane jest miejsce, w którym znajduje się „0”, a następnie skanowane jest miejsce, w którym znajduje się „1”, aby je podświetlić. W ten sposób można uzyskać wzór znaku „口”.
Czcionki znaków chińskich są uporządkowane zgodnie z kodem standardu narodowego i przechowywane w pamięci w postaci plików binarnych, tworząc bibliotekę czcionek znaków chińskich, zwaną także biblioteką glifów znaków chińskich lub biblioteką znaków chińskich.
Dwie metody kodowania, patrz plik nagłówkowy
GB1616.h//------------------ Data structure definition of Chinese character font ------------------------//struct typFNT_GB16 //Chinese character font data structure { unsignedchar Index[3]; //Chinese character internal code index unsignedchar Msk[32]; //Dot matrix code data }; ///////////////////////////////////////////////////////////////////////////// Chinese character font table //// Chinese character library: Song style 16.dot, horizontal modulo left high bit, data arrangement: left to right, top to bottom ///////////////////////////////////////////////////////////////////////////// conststruct typFNT_GB16 codeGB_16[]= //Data table {/*------------------------------------------------------------------------------------------------ Source file/text: Xu; Width×Height (pixels):16×16---------------------------------------------------------------------------------*/ "Xu",0x10,0x80,0x10,0x80,0x21,0x40,0x42,0x20,0x94,0x10,0x1B,0xEC,0x20,0x80,0x60,0x8 0,0xAF,0xF8,0x20,0x80,0x22,0xA0,0x24,0x90,0x2A,0x88,0x21,0x00,0x00,0x00,0x00,0x00,
This structure is very simple:One is the internal code, a dot matrix sequence. The previous dot matrix library was placed in the order of the internal code, and no internal code index was needed. If only some Chinese characters were placed, the internal code index was needed. (The Chinese character "Xu" in the front is to find the dot matrix sequence of the word when outputting "Xu". This dot matrix sequence is written by myself. When displayed with 1602, because the chip has an English dot matrix sequence in the memory, there is no need to write it.) Generally, two bytes are enough for the internal code. If you use one more byte, you just add a trailing 0. In this way, the Chinese character string can be directly placed in the Chinese character internal code;
13,12864 LCD:
Każdy punkt wyświetlania odpowiada liczbie binarnej, 1 oznacza włączony, 0 oznacza wyłączony. Pamięć RAM, która przechowuje te informacje z matrycy punktowej, nazywana jest pamięcią danych wyświetlacza. Aby wyświetlić określony znak graficzny lub chiński, należy zapisać odpowiednie informacje z matrycy punktowej w odpowiedniej jednostce pamięci.
Licznik adresów (AC) pamięci graficznej automatycznie zwiększa adres poziomy (oś X) tylko o jeden. Gdy adres poziomy = 0FH, zostanie zresetowany do 00H. Nie zwiększy on jednak automatycznie adresu pionowego z przeniesieniem. Dlatego, gdy wiele danych jest zapisywanych w sposób ciągły, program musi ustalić, czy adres pionowy wymaga zresetowania.
14,Graphics RAM (GDRAM)
The drawing display RAM provides 128×8 bytes of memory space. When changing the drawing RAM, first write the horizontal and vertical coordinate values continuously, and then write two bytes of data to the drawing RAM. The address counter (AC) will automatically increase the horizontal address (X address) by one. When the horizontal address is 0XFH, it will be reset to 00H; the vertical address will not be automatically incremented by 1. The drawing display must be turned off during writing to drawing RAM.
[cpp] view plain copy//Display Chinese characters voiddispString (uchar X, Y,uchar *msg) //Which row is X and which column is Y. msg is Chinese characters { if(X==0) X = 0x80; // First line, Chinese characters display coordinates else if(X==1) write_data(*msg++); //Display Chinese characters } } ////////////////////////////////// //////////////// //////////////// // Display image voiddisppicture(uchar code *adder) { uint i,j; //*******Display the upper half screen content setting for(i=0;i<32;i++) // 32 column addresses in the upper half of the screen { write_com(0x80 + i); //SET vertical address VERTICALADD write_com(0x80); //SET horizontal address HORIZONTAL ADD for(j=0;j<16;j++) { write_data(*adder); adder++; } } //************Display the content settings of the lower half of the screen for(i=0;i<32;i++) // { write_com(0x80 + i); //SET vertical address VERTICALADD write_com(0x88); //SET horizontal address HORIZONTAL ADD for(j=0;j<16;j++) { write_data(*adder); adder++; } } } For the C language, space is automatically allocated for a defined variable, and its address is the name of the variable. Through this name, the data can be retrieved in the memory and new data can be obtained through calculation. However, in assembly, the programmer needs to define the storage space and send the data to the accumulator for calculation. Every step requires the programmer's operation. In C language, these processes are completed by the compiler.
15,Some useful FAQs
①. Jak przebiega alokacja pamięci zmiennych w języku C mikrokontrolera? Czy możliwe jest, że kompilator inteligentnie dodaje kod alokacji i recyklingu podczas kompilacji? Kluczową kwestią jest to, jak mogę upewnić się, że program, który stworzyłem, nie zawiera błędów przepełnienia pamięci? Jeśli wykonuję operację rekurencyjną, wymagania dotyczące pamięci są trudne do samodzielnego obliczenia.
②. Czy język C mikrokontrolera będzie ograniczony w definiowaniu zmiennych? Na przykład, operacje mnożenia i dzielenia danych zmiennoprzecinkowych są zapisywane w asemblerze, a kod jest dość skomplikowany. Czy napisanie go bezpośrednio w języku C nie byłoby zbyt proste?
③. Czy w pliku heksadecymalnym generowanym przez język C mikrokontrolera, rozkład adresów instrukcji i danych w pamięci ROM jest automatycznie przypisywany przez kompilator? Czy użytkownicy mogą go przypisać?
Answer 1: The microcontroller program written in C language is first compiled by a program (it seems to be c51.exe). After the compilation is completed, the storage space size of the variables has been arranged, but the specific address has not yet been allocated (the address is floating). Next, another program (it seems to be a51.exe) is connected. After the connection, the specific address is determined.
Jeśli zmiennych jest zbyt wiele, kompilator wyświetli komunikat o zbyt dużym segmencie danych. Aby uniknąć błędu przepełnienia pamięci, należy przede wszystkim sprawdzić, czy nie doszło do przepełnienia stosu, a to zależy od doświadczenia.
Język C w mikrokontrolerach generalnie zabrania rekurencji, a operacje rekurencyjne są zazwyczaj unikane. W końcu mikrokontrolery to nie komputery PC, co wpłynie na szybkość. Jeśli chcesz rekurencji, bardziej odpowiednie będzie użycie układu DSP. Krótko mówiąc, musisz umieć wybrać odpowiedni układ.
Odpowiedź 2: Rozmiar zmiennej (liczba cyfr) jest zazwyczaj taki sam, jak liczba cyfr w akumulatorze chipów. Na przykład, 51 zazwyczaj używa 8 bitów, ponieważ jest 8-bitowym mikrokontrolerem.
Mikrokontroler może definiować zmienne bitowe, ale nie może definiować tablic bitowych. Pisanie w języku C wydaje się proste, ale w rzeczywistości generuje najwięcej kodu. Mikrokontroler używany do sterowania rzadko korzysta z operacji zmiennoprzecinkowych, co jest nie tylko powolne, ale i kłopotliwe oraz zajmuje dużo miejsca. Jeśli jest to układ DSP, znacznie lepiej sprawdzi się odpowiednia struktura sprzętowa.
Odpowiedź 3: Zazwyczaj jest on przydzielany automatycznie. Można go zaprogramować w połączeniu języka C i języka asemblera lub zmontować online za pomocą Keil C. Wymiana danych między układem scalonym a środowiskiem zewnętrznym odbywa się poprzez port.
Zastrzeżenie: Niniejszy artykuł został przedrukowany z „International Electronic Business Information”. Niniejszy artykuł przedstawia wyłącznie osobiste poglądy autora i nie reprezentuje poglądów Sacco Micro ani branży. Jest on przeznaczony wyłącznie do przedruku i udostępniania oraz służy ochronie praw własności intelektualnej. Prosimy o podanie oryginalnego źródła i autora przedruku. W przypadku naruszenia prosimy o kontakt w celu usunięcia artykułu.
Numer telefonu firmy: +86-0755-83044319
Faks/FAKS: +86-0755-83975897
E-mail: 1615456225@qq.com
QQ: 3518641314 Menedżer Li
QQ: 332496225 Menedżer Qiu
Adres: Pokój 809, Budynek C, Budynek Technologii Zhantao, nr 1079 Minzhi Avenue, Nowa Dzielnica Longhua, Shenzhen




粤公网安备44030002007346号