서비스 핫라인
모니터나 프린터에 한자를 출력하기 위해서는 그래픽 기호에 따라 한자를 도트 매트릭스 형태로 디자인하고, 이에 해당하는 도트 매트릭스 코드(글리프 코드)를 얻어야 합니다.
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 2004H 3FFAH 0H 0000H 0000H. 컴퓨터가 "口"를 출력하려고 할 때, 먼저 디스플레이 폰트 라이브러리의 첫 번째 주소를 찾고, "口"의 내부 코드를 기반으로 계산한 다음, "口"의 문자 코드를 찾습니다. 그리고 문자 생성기의 제어를 통해 해당 문자 코드(이진수)에 따라 화면을 순차적으로 스캔합니다. 이진 코드가 "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을 디스플레이 데이터 메모리라고 합니다. 특정 그림이나 한자를 표시하려면 해당 도트 매트릭스 정보를 해당 저장 장치에 기록해야 합니다.
그래픽 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 언어에서 생성된 헥스 파일에서 명령어 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
이메일: 1615456225@qq.com
QQ: 3518641314 리 관리자
QQ: 332496225 Qiu 관리자
주소: 중국 선전시 룽화신구 민즈대로 1079번지 전타오테크놀로지빌딩 C동 809호




粤公网安备44030002007346号