خط تلفن خدمات
برای نمایش حروف چینی روی مانیتور یا چاپگر، حروف چینی طبق نمادهای گرافیکی به صورت ماتریس نقطهای طراحی میشوند و کد ماتریس نقطهای مربوطه (کد گلیف) به دست میآید.
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:
هر نقطه نمایش مربوط به یک عدد دودویی است، ۱ به معنی روشن و ۰ به معنی خاموش. حافظه رمی که این اطلاعات ماتریس نقطهای را ذخیره میکند، حافظه داده نمایشگر نامیده میشود. برای نمایش یک کاراکتر گرافیکی یا چینی خاص، باید اطلاعات ماتریس نقطهای مربوطه را در واحد ذخیرهسازی مربوطه نوشت.
شمارنده آدرس (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 نوشته شود، آیا خیلی ساده نخواهد بود؟
۳. در فایل هگز تولید شده توسط زبان 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 مناسبتر است. به طور خلاصه، باید بتوانید تراشه مناسب را انتخاب کنید.
پاسخ ۲: اندازه متغیر (تعداد ارقام) عموماً برابر با تعداد ارقام موجود در انباره تراشه است. برای مثال، ۵۱ معمولاً از ۸ بیت استفاده میکند زیرا یک میکروکنترلر ۸ بیتی است.
میکروکنترلر میتواند متغیرهای بیتی را تعریف کند، اما نمیتواند آرایههای بیتی را تعریف کند. نوشتن به زبان C ساده به نظر میرسد، اما در واقع بیشترین حجم کد را تولید میکند. میکروکنترلری که برای کنترل استفاده میشود به سختی از عملیات ممیز شناور استفاده میکند که نه تنها کند است، بلکه دردسرساز است و فضا را اشغال میکند. اگر یک تراشه DSP باشد، اگر ساختار سختافزاری مناسبی داشته باشد، بسیار بهتر خواهد بود.
پاسخ ۳: عموماً، به طور خودکار تخصیص داده میشود. میتوان آن را با ترکیبی از زبان C و زبان اسمبلی برنامهریزی کرد، یا میتوان آن را به صورت آنلاین با استفاده از Keil C اسمبل کرد. تبادل داده بین تراشه و خارج از طریق پورت انجام میشود.
سلب مسئولیت: این مقاله از «اطلاعات بینالمللی تجارت الکترونیک» کپی شده است. این مقاله فقط بیانگر دیدگاههای شخصی نویسنده است و بیانگر دیدگاههای ساکو میکرو و صنعت مربوطه نمیباشد. این مقاله فقط برای چاپ مجدد و اشتراکگذاری است و از حمایت از حقوق مالکیت معنوی پشتیبانی میکند. لطفاً برای چاپ مجدد، منبع اصلی و نویسنده را ذکر کنید. در صورت وجود هرگونه نقض، لطفاً برای حذف آن با ما تماس بگیرید.
شماره تلفن شرکت: +86-0755-83044319
فکس/فکس: +86-0755-83975897
ایمیل: 1615456225@qq.com
QQ: 3518641314 مدیر لی
QQ: 332496225 مدیر کیو
آدرس: اتاق ۸۰۹، ساختمان C، ساختمان فناوری ژانتائو، پلاک ۱۰۷۹ خیابان مینزی، منطقه جدید لونگهوا، شنژن




粤公网安备44030002007346号