Service Hotline
על מנת להפיק תווים סיניים על צג או מדפסת, התווים הסיניים מעוצבים למטריצת נקודות לפי סמלים גרפיים, ומתקבל קוד מטריצת הנקודות המתאים (קוד גליף).
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.
קוד במצלמה
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.
אם נחליף את ה-"." של גרפיקת "口" זו ב-"0", נוכל לקבל את קוד הגליף של "口" בצורה חיה מאוד: 0000H 0004H 3FFAH 2004H 2004H 2004H 2004H 2004H 2004H 2004H 2004H 3FFAH 2004H 0000H 0000H. כאשר המחשב רוצה להפיק פלט של "口", הוא מוצא תחילה את הכתובת הראשונה של ספריית גופני התצוגה, מחשב על סמך הקוד הפנימי של "口", ולאחר מכן מוצא את קוד הגליף של "口", ולאחר מכן סורק את המסך ברצף בהתאם לקוד הגליף (בבינארי) באמצעות בקרת מחולל התווים. כאשר הקוד הבינארי הוא "0", המקום שבו הוא "0" נסרק, והמקום שבו הוא "1" נסרק כדי להדגיש, כך שניתן לקבל את תבנית התווים "口".
גופני תווים סיניים מסודרים לפי סדר הקוד הסטנדרטי הלאומי ומאוחסנים בזיכרון בצורת קבצים בינאריים, ויוצרים ספריית גופני תווים סיניים, המכונה גם ספריית גליפים של תווים סיניים, או ספריית תווים סיניים.
שתי שיטות קידוד, ראה קובץ כותרת
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:
כל נקודת תצוגה מתאימה למספר בינארי, 1 פירושו דלוק, 0 פירושו כבוי. זיכרון ה-RAM שמאחסן את מידע מטריצת הסיכות הללו נקרא זיכרון נתוני תצוגה. כדי להציג גרפיקה מסוימת או תו סיני, יש לכתוב את מידע מטריצת הסיכות המתאים ליחידת האחסון המתאימה.
מונה הכתובות (AC) של זיכרון הגרפיקה יגדיל אוטומטית את הכתובת האופקית (ציר X) רק באחד. כאשר הכתובת האופקית = 0FH, היא תאופס ל-00H. עם זאת, הוא לא יגדיל אוטומטית את הכתובת האנכית עם העברת נתונים. לכן, כאשר נתונים מרובים נכתבים ברציפות, התוכנית צריכה לקבוע האם יש לאפס את הכתובת האנכית.
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
1. כיצד מתבצעת הקצאת זיכרון של משתנים בשפת המיקרו-בקר C? האם ייתכן שהמהדר מוסיף באופן חכם קוד הקצאה ומיחזור במהלך תהליך הקומפילציה? הנקודה המרכזית היא כיצד אוכל להבטיח שהתוכנית שיצרתי לא תהיינה בה שגיאות גלישת זיכרון? אם אני מבצע פעולה רקורסיבית, קשה לחשב את דרישות הזיכרון בעצמי.
2. האם שפת C של המיקרו-בקר תהיה מוגבלת בהגדרת משתנים? לדוגמה, פעולות הכפל והחילוק של נתוני נקודה צפה נכתבות באמצעות אסמבלי, והקוד די מסובך. אם היה כתוב ישירות בשפת C, האם זה לא היה פשוט מדי?
③. בקובץ ההקסדצימלי שנוצר על ידי שפת C של המיקרו-בקר, האם התפלגות הכתובות של פקודות ונתוני ROM מוקצית אוטומטית על ידי המהדר? האם משתמשים יכולים להקצות אותה?
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.
אם יש יותר מדי משתנים, המהדר יציג הודעה שקטע הנתונים גדול מדי. כדי להבטיח שלא תהיה שגיאת גלישת זיכרון, השיקול העיקרי הוא האם המחסנית גולשת, וזה תלוי בניסיון.
שפת C של מיקרו-בקרים אוסרת בדרך כלל על רקורסיה, ופעולות רקורסיביות נמנעות בדרך כלל. אחרי הכל, מיקרו-בקרים אינם מחשבים אישיים, מה שישפיע על המהירות. אם רוצים לבצע רקורסיה, עדיף להשתמש בשבב DSP. בקיצור, עליכם להיות מסוגלים לבחור את השבב המתאים.
תשובה 2: גודל המשתנה (מספר הספרות) זהה בדרך כלל למספר הספרות במצבר השבבים. לדוגמה, 51 משתמש בדרך כלל ב-8 סיביות מכיוון שהוא מיקרו-בקר של 8 סיביות.
המיקרו-בקר יכול להגדיר משתני סיביות, אך אינו יכול להגדיר מערכי סיביות. כתיבה בשפת C נראית פשוטה, אך למעשה מייצרת את כמות הקוד הגדולה ביותר. המיקרו-בקר המשמש לבקרה כמעט ולא משתמש בפעולות נקודה צפה, שהן לא רק איטיות אלא גם בעייתיות ותופסות מקום. אם מדובר בשבב DSP, יהיה הרבה יותר טוב אם יהיה לו מבנה חומרה מתאים.
תשובה 3: בדרך כלל, הוא מוקצה אוטומטית. ניתן לתכנת אותו בשילוב של שפת C ושפת אסמבלי, או שניתן להרכיב אותו באופן מקוון באמצעות Keil C. חילופי הנתונים בין השבב לחוץ מתבצעים דרך הפורט.
הצהרת אחריות: מאמר זה נלקח מ"מידע עסקי אלקטרוני בינלאומי". מאמר זה מייצג רק את דעותיו האישיות של המחבר ואינו מייצג את דעותיה של Sacco Micro והתעשייה. הוא מיועד להדפסה חוזרת ושיתוף בלבד ותומך בהגנה על זכויות קניין רוחני. אנא ציינו את המקור המקורי ואת המחבר לצורך הדפסה חוזרת. במקרה של הפרה כלשהי, אנא צרו עמנו קשר כדי למחוק אותה.
מספר טלפון של החברה: 86-0755-83044319+
פקס/פקס: 86-0755-83975897+
דוא"ל: 1615456225@qq.com
QQ: 3518641314 מנהל לי
QQ: 332496225 מנהל Qiu
כתובת: חדר 809, בניין C, בניין הטכנולוגיה ז'אנטאו, שדרת מינגז'י מס' 1079, רובע לונגהואה החדש, שנזן




粤公网安备44030002007346号