الخط الساخن للخدمة
من أجل إخراج الأحرف الصينية على شاشة أو طابعة، يتم تصميم الأحرف الصينية في مصفوفة نقطية وفقًا للرموز الرسومية، ويتم الحصول على رمز المصفوفة النقطية المقابل (رمز الرسوم).
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
① كيف تتم عملية تخصيص الذاكرة للمتغيرات في لغة C الخاصة بالمتحكمات الدقيقة؟ هل من الممكن أن يقوم المترجم بإضافة تعليمات تخصيص وإعادة تدوير ذكية أثناء عملية الترجمة؟ الأهم هو كيف يمكنني ضمان خلو البرنامج الذي كتبته من أخطاء تجاوز سعة الذاكرة؟ إذا كنت أقوم بعملية تكرارية، فسيكون من الصعب حساب متطلبات الذاكرة بنفسي.
٢. هل ستكون لغة C الخاصة بالمتحكمات الدقيقة مقيدة في تعريف المتغيرات؟ على سبيل المثال، تتم كتابة عمليات الضرب والقسمة للبيانات ذات الفاصلة العائمة باستخدام لغة التجميع، ويكون الكود معقدًا للغاية. ألا يكون الكود بسيطًا جدًا إذا كُتب مباشرةً بلغة C؟
③. في ملف hex الذي تم إنشاؤه بواسطة لغة C الخاصة بالمتحكم الدقيق، هل يتم تعيين توزيع عناوين ذاكرة القراءة فقط للتعليمات والبيانات تلقائيًا بواسطة المُصرّف؟ هل يمكن للمستخدمين تعيينها؟
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). باختصار، يجب عليك اختيار الشريحة المناسبة.
الإجابة الثانية: عادةً ما يكون حجم المتغير (عدد الأرقام) مساوياً لعدد الأرقام في مُراكم الشريحة. على سبيل المثال، يستخدم العدد 51 عادةً 8 بتات لأنه متحكم دقيق 8 بت.
يمكن للمتحكم الدقيق تعريف متغيرات البت، لكنه لا يستطيع تعريف مصفوفات البت. قد يبدو استخدام لغة C بسيطًا، ولكنه في الواقع يُنتج أكبر قدر من التعليمات البرمجية. نادرًا ما يستخدم المتحكم الدقيق المستخدم للتحكم عمليات الفاصلة العائمة، مما يجعله بطيئًا ومُرهقًا ويستهلك مساحة تخزين كبيرة. إذا كان شريحة معالجة الإشارات الرقمية (DSP)، فسيكون من الأفضل بكثير أن تتمتع ببنية أجهزة مناسبة.
الإجابة 3: عادةً ما يتم تخصيصها تلقائيًا. يمكن برمجتها باستخدام مزيج من لغة C ولغة التجميع، أو يمكن تجميعها مباشرةً باستخدام Keil C. يتم تبادل البيانات بين الشريحة والخارج عبر المنفذ.
تنويه: هذه المقالة مقتبسة من "المعلومات التجارية الإلكترونية الدولية". لا تعكس هذه المقالة سوى وجهة نظر الكاتب الشخصية، ولا تمثل آراء شركة ساكو مايكرو أو قطاع الصناعة. يُسمح بإعادة نشرها ومشاركتها فقط، وذلك دعمًا لحماية حقوق الملكية الفكرية. يُرجى ذكر المصدر الأصلي واسم الكاتب عند إعادة النشر. في حال وجود أي انتهاك، يُرجى التواصل معنا لحذفها.
رقم هاتف الشركة: +86-0755-83044319
فاكس: +86-0755-83975897
بريد إلكتروني: 1615456225@qq.com
س: 3518641314 مدير لي
ف ف: 332496225 مدير تشيو
العنوان: الغرفة 809، المبنى ج، مبنى زانتاو للتكنولوجيا، رقم 1079 شارع مينزي، منطقة لونغهوا الجديدة، شنتشن




粤公网安备44030002007346号