サービスホットライン
モニターやプリンターに中国語の文字を出力するためには、中国語の文字をグラフィックシンボルに基づいてドットマトリックスに設計し、対応するドットマトリックスコード(グリフコード)を取得する。
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 2004H 3FFAH 2004H 0000H 0000H。コンピュータが「口」を出力したい場合、まず表示フォントライブラリの最初のアドレスを見つけ、「口」の内部コードに基づいて計算し、「口」のグリフコードを見つけ、文字ジェネレータの制御によってグリフコード(バイナリ)に従って画面を順次スキャンします。バイナリコードが「0」の場合は「0」の箇所をスキャンし、「1」の箇所をスキャンして強調表示することで、「口」の文字パターンを取得できます。
中国語の文字フォントは、国家標準コードの順序で並べられ、バイナリファイルの形式でメモリに保存され、中国語の文字フォントライブラリ(中国語の文字グリフライブラリ、または中国語の文字ライブラリとも呼ばれる)を形成します。
エンコード方法は2種類あります。詳細はヘッダーファイルを参照してください。
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は、表示データメモリと呼ばれます。特定の図形や漢字を表示するには、対応するドットマトリックス情報を対応する記憶装置に書き込む必要があります。
グラフィックRAMのアドレスカウンタ(AC)は、水平アドレス(X軸)のみを自動的に1ずつインクリメントします。水平アドレスが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言語によって生成されるhexファイルにおいて、命令ROMとデータ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言語は一般的に再帰を禁止しており、再帰的な処理は一般的に避けるべきです。マイクロコントローラはPCではないため、処理速度に影響が出ます。再帰処理が必要な場合は、DSPチップを使用する方が適切です。つまり、適切なチップを選択できることが重要です。
回答2:変数のサイズ(桁数)は、一般的にチップのアキュムレータの桁数と同じです。例えば、51は8ビットのマイクロコントローラを使用しているため、通常は8ビットを使用します。
マイクロコントローラはビット変数を定義できますが、ビット配列を定義できません。C言語での記述は簡単そうに見えますが、実際には最も多くのコードを生成します。制御に使用されるマイクロコントローラは浮動小数点演算をほとんど使用しないため、処理速度が遅いだけでなく、処理が煩雑で、メモリ容量も消費します。DSPチップであれば、適切なハードウェア構造を備えている方がはるかに優れています。
回答3:一般的に、メモリは自動的に割り当てられます。C言語とアセンブリ言語を組み合わせてプログラミングすることも、Keil Cを使用してオンラインでアセンブルすることも可能です。チップと外部間のデータ交換はポートを介して行われます。
免責事項:この記事は「国際電子商取引情報」からの転載です。この記事は著者の個人的な見解を示すものであり、サッコマイクロおよび業界の見解を示すものではありません。転載および共有のみを目的としており、知的財産権の保護を支持します。転載の際は、出典と著者を明記してください。著作権侵害が疑われる場合は、削除いたしますのでご連絡ください。
会社の電話番号:+86-0755-83044319
ファックス番号:+86-0755-83975897
Eメール:1615456225@qq.com
QQ: 3518641314 李マネージャー
QQ: 332496225 邱マネージャー
住所:深圳市龍華新区民治大道1079号 占濤科技ビルC棟809室




粤公网安备44030002007346号