สายด่วนบริการ
ในการแสดงผลอักษรจีนบนจอภาพหรือเครื่องพิมพ์ จะต้องออกแบบอักษรจีนลงในเมทริกซ์จุดตามสัญลักษณ์กราฟิก และจะได้รหัสเมทริกซ์จุด (รหัสสัญลักษณ์) ที่สอดคล้องกัน
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) ของหน่วยความจำกราฟิก (RAM) จะเพิ่มแอดเดรสแนวนอน (แกน 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
①. การจัดสรรหน่วยความจำของตัวแปรในภาษา C สำหรับไมโครคอนโทรลเลอร์นั้นดำเนินการอย่างไร? เป็นไปได้หรือไม่ที่คอมไพเลอร์จะเพิ่มโค้ดการจัดสรรและการรีไซเคิลอย่างชาญฉลาดในระหว่างกระบวนการคอมไพล์? ประเด็นสำคัญคือ โปรแกรมที่ฉันสร้างขึ้น ฉันจะมั่นใจได้อย่างไรว่าไม่มีข้อผิดพลาดหน่วยความจำล้น? หากฉันกำลังดำเนินการแบบเรียกซ้ำ การคำนวณความต้องการหน่วยความจำด้วยตนเองจะทำได้ยาก
②. ภาษา C สำหรับไมโครคอนโทรลเลอร์จะมีข้อจำกัดในการกำหนดตัวแปรหรือไม่? ตัวอย่างเช่น การดำเนินการคูณและหารข้อมูลทศนิยมเขียนด้วยภาษาแอสเซมบลี ซึ่งโค้ดค่อนข้างซับซ้อน หากเขียนโดยตรงด้วยภาษา C จะง่ายเกินไปหรือไม่?
③. ในไฟล์ hex ที่สร้างขึ้นโดยภาษา 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 บิต
ไมโครคอนโทรลเลอร์สามารถกำหนดตัวแปรบิตได้ แต่ไม่สามารถกำหนดอาร์เรย์บิตได้ การเขียนด้วยภาษาซีดูเหมือนจะง่าย แต่ในความเป็นจริงแล้วกลับสร้างโค้ดจำนวนมากที่สุด ไมโครคอนโทรลเลอร์ที่ใช้ควบคุมแทบจะไม่ใช้การคำนวณเลขทศนิยม ซึ่งไม่เพียงแต่ช้า แต่ยังยุ่งยากและเปลืองพื้นที่อีกด้วย หากเป็นชิป DSP จะดีกว่ามากหากมีโครงสร้างฮาร์ดแวร์ที่เหมาะสม
คำตอบที่ 3: โดยทั่วไปแล้ว จะมีการจัดสรรโดยอัตโนมัติ สามารถเขียนโปรแกรมได้โดยใช้ภาษา C และภาษาแอสเซมบลีผสมกัน หรือสามารถประกอบแบบออนไลน์โดยใช้ Keil C การแลกเปลี่ยนข้อมูลระหว่างชิปกับภายนอกจะทำผ่านพอร์ต
ข้อสงวนสิทธิ์: บทความนี้คัดลอกมาจาก "International Electronic Business Information" บทความนี้เป็นเพียงความคิดเห็นส่วนตัวของผู้เขียนเท่านั้น และไม่ได้แสดงถึงความคิดเห็นของ Sacco Micro และอุตสาหกรรม การนำไปพิมพ์ซ้ำและเผยแพร่ต่อเป็นไปเพื่อสนับสนุนการคุ้มครองสิทธิ์ในทรัพย์สินทางปัญญาเท่านั้น โปรดระบุแหล่งที่มาและผู้เขียนต้นฉบับก่อนนำไปพิมพ์ซ้ำ หากพบการละเมิดลิขสิทธิ์ โปรดติดต่อเราเพื่อลบออก
หมายเลขโทรศัพท์ของบริษัท: +86-0755-83044319
โทรสาร: +86-0755-83975897
อีเมล์: 1615456225@qq.com
QQ: 3518641314 ผู้จัดการหลี่
QQ: 332496225 ผู้จัดการชิว
ที่อยู่: ห้อง 809 อาคาร C อาคารเทคโนโลยีจ้านเทา เลขที่ 1079 ถนนหมินจือ เขตหลงหัวใหม่ เมืองเซินเจิ้น




粤公网安备44030002007346号