Abstract: Needs to demonstrate when the Chinese character are many, in the monolithic integrated circuit system’s Chinese character code is tedious. This article introduced that one kind takes the monolithic integrated circuit system’s Chinese character code directly using the PC machine Chinese character encoding, simplifies system’s design.
Key word: Monolithic integrated circuit liquid-crystal display 29F040 Chinese character demonstration
Introduction
In the modern industry control and in some intellectualization instruments and meters, more and more places need to use the dot pattern monitor to demonstrate the Chinese character. The Chinese character display mode usually is first according to the Chinese character extraction Chinese character lattice which needs (for example 16×16 lattice), stores ROM the lattice file, forms the new Chinese character code; But when use just needed first according to the new Chinese character code composition sentence, then acts according to the new code extraction corresponding lattice by MCU to carry on the Chinese character demonstration. In this display mode, if uses the class number of words quantity is big when or the sentence are many, the use Chinese character’s new code composition sentence will be one very tedious and the arid work. In view of this kind of situation, this article proposed one very simple way - - takes the monolithic integrated circuit system’s code directly using the PC machine Chinese character encoding. Below is as follows take 8031 monolithic integrated circuit systems as the example elaboration:
First, hardware composition
In this system uses Hong Kong Fine Electricity Company’s built-in T6963 the controller [1] 240128T dot pattern liquid-crystal display. This monitor 1 behavior 240 spots, can hold 16×16 lattice Chinese character 15, the total enumeration is 128 spots, can demonstrate 8 lines of Chinese characters. In order to use the MCU operation to be possible to use 1 piece of 512KB the memory (for example in this system’s 29F040) uses for to save the complete GB code 16×16 lattice Chinese distant, 8×16 the ASCII code lattice data as well as the Chinese character sentence coded data. In order to reduce the cost and reduce the volume, is not the very high situation may also use the large capacity serial data memory regarding the speed request, like AT45DB041B. Concrete hardware control electric circuit as shown in Figure 1 (with Chinese character demonstrated has nothing to do with electric circuit omitted).
Because the 29F040 capacity is 512KB, but 5031 micro controllers can only manage 64KB the data, therefore may divide into 29F040 16 pages, each page of 32KB, occupies the monolithic integrated circuit system data space 8000H~0FFFFH (surplus 32KB is monolithic integrated circuit system’s other memories and peripheral device). Page number by monolithic integrated circuit’s P1.0~P1.3 choice. Liquid-crystal display’s address is 7FF8H~7FF9H.
Second, Chinese character display principle and software design
UCDOS in software’s document HZK16 and document ASC16 respectively be 16×16 GB code Chinese character lattice file and 8×16 ASCII code lattice file, by binary form memory. In document HZK16, has in GB code position stopwatch all Chinese characters in turn from infancy to maturity according to the Chinese character zone bit code, each Chinese character takes 32 bytes, each area is 94 Chinese characters. In document ASC16 has in turn from infancy to maturity according to the ASCII code 8×16 the ASCII code lattice, each ASCII code takes 16 bytes.
In the PC machine text document, the Chinese character is by machine the encoding form memory, each Chinese character takes two bytes: The first byte is the area code, for with ASCII code difference, (what the scope starts from hexadecimal system’s 0A1H is smaller than 80H is ASCII code character), the corresponding zone bit code central area code first area; The second byte is the position code, the scope is also starts from 0A1H, to correspond in some area the first position code. Thus, subtracts the Chinese character machine encoding 0A0AH on this Chinese character zone bit code.
For example Chinese character “room” machine encoding for hexadecimal system “B7BF”, “B7″ the expression area code, “BF” expresses the position code. Therefore “room” the zone bit code is 0B7BFH-0A0A0H=171FH. Respectively transform results in the Chinese character for the decimal base “the room” the zone bit code the area code and the position code are “2331″, namely “room” the lattice located at the 23rd area’s 31st character’s position, is equal to the document HZK16 position for 32×[(23-1) ×94 (31-1)] the =67136B later 32 bytes will be “the room” the demonstration lattice.
In this monolithic integrated circuit system, start address’s high 4 are the page numbers, delivers the P1 mouth, low 15 for the data area address, deliver indicator DPTR. The instruction takes 32 bytes using “MOVX” to deliver LCD continuously the relevant position, can realize the correct Chinese character demonstration.
The ASCII code’s demonstration and the Chinese character demonstration basic principle is the same. In document ASC16 the existence machine encoding’s question, its demonstration lattice does not arrange in turn from infancy to maturity directly according to the ASCII code, is only each ASCII code only occupies 1 byte in the text document, and is smaller than 80H, moreover ASCII code for 8×16 lattice, therefore in the ASCII16 document, each ASCII code’s lattice also only occupies 16 bytes.
First withdraws 16×16 GB code Chinese character lattice and 8×16 the ASCII code lattice (for example in UCDOS software’s HZK16 and ASC16) and read in directly it 29F040. And HZK16 (altogether 256KB) dian0~7 page. For ease of programming, ASC16, although only then 4KB, also takes the 8th page alone. Other are left over the space uses for to save the Chinese character sentence the code.
Because 240×128 lattice LED monitor each can only demonstrate 15 Chinese characters (16×16 lattice Chinese character), namely 30 bytes. Therefore may need to demonstrate the sentence is 1 line carries on the compilation according to 30 bytes, the insufficient 30 characters make up the blank space. Carries on the input when PC machine, each line of 30 characters add on the carriage return key again and line feed the symbol, the reality occupy 32 characters. Inputs the sentence saves the plate by the plain text form, reads in again this text document by the binary form 29F040 the 9th page. Then, later according to the sentence store which needs to demonstrate then may carry on the correct demonstration. This, the author promotes recommends uses DOS the edition the WPS software “to edit the non-article to receive the document” the function, it can demonstrate clearly whether each line does have 30 characters.
According to the above principle, demonstrated that 1 line of Chinese characters concrete program diagram as shown in Figure 2.
For convenience reader, already in practical application through the assembly subroutine lists as follows (about LCD the controller T6963 user law audience reference 1).
LCDCOM EQU 7FF9H
LCDDAT EQU 7FF8H
; Demonstrates 1 line of Chinese character subroutine
; The Chinese character sentence position numbers DPTR; Store: R6 PRHZ:MOV 24H, DPH
MOV 25H, DPL
PUSH DPH
PUSH DPL
MOV A, DPH; Computation page number
RR A
RR A
ADD A,#9; Starts from the 9th area to deposit each line of characters machine the encoding
ORL A,#0F0H
MOV P1, A
LCALL RL245; The store is multiplied by 32 (each line of 32 characters)
SETB 24H,7; Data address located at 8000H~0FFFFH
MOV DPH,24H
MOV DPL,25H
MOV R0,#0E0H
MOV R7,#30; Takes out 30 characters continuously to the 0E0H internal data memory
PRHZ3:MOVX A,@DPTR
MOV @R0, A
INC R0
INC DPTR
DJNZ R7, PRHZ3
MOV 1DH,#30; After demonstrating 0E0H line of characters (altogether 30)
MOV R5,#0; When front row R5
MOV R0,#0E0H
MOV A,#7FH; Whether is the ASCII code?
CLR C
SUBB A,@R0
JC DPHZ1
MOV 26H,@R0
INC R0
MOV 24H, R6; ASCII code demonstration
MOV 25H, R5
LCALL PRASCII
SJMP PRHZ4
DPHZ1:MOV 24H,@R0; Will be the Chinese character machine the encoding will deliver 24H25H
INC R0
MOV 25H,@R0
INC R0
MOV A,25H
CLR C
SUBB A,#0A1H; Machine the encoding transforms into the binary area code and the position code
MOV 25H, A
MOV A,24H
CLR C
SUBB A,#0A1H
LCALLDPONHZ; Demonstrates 1 Chinese character
DEC 1DH
INC R5
PRHZ4:INC R5
DJNZ 1DH, PRHZ5
POP DPL
POP DPH
RET
PR0:MOV DPTR,#LCDCOM; Reads the condition
MOVX A,@DPTR
RET
PR01:LCALLPR0; Before reading, writes a data,
JNB ACC.0, PR01
JNB ACC.1, PR01
RET
PR02:LCALL PR0; Reads before continuously,
JNB ACC.2, PR02
RET
PR03:LCALL PR0; Writes before continuously,
JNB ACC.3, PR02
RET
PR1:LCALL PR01; Double byte parameter R2, R3
MOV A, R2
LCALL PR14
PR11:LCALL PR01; Single byte parameter R3
MOV A, R3
LCALL PR14
PR12:LCALL PR01; Non-parameter instruction R4
MOV A, R4
SJMP PR15
PR14:MOV DPTR,#LCDDAT
PR15:MOVX @DPTR, A
RET
RL245:MOV R7,#5; 24H25H shifts to the left 5
RLL1:CLR C
MOV A,25H
RLC A
MOV 25H, A
MOV A,24H
RLC A
MOV 24H, A
DJNZ R7, RLL1
RET
; Good position R6 (0~7), arranges in order position R5 (0~29), the Chinese character distinguishes 24H, position code 25H
DPONHZ:MOV A,24H; Demonstrates 1 Chinese character
MOV B,#94; Each area 94 Chinese characters
MUL AB
ADD A,25H
MOV 25H, A
CLR A
ADDC A, B
MOV 24H, A
RR A; Obtains 32KB is 1 page of page number
RR A
ORL A,#0F0H
MOV P1, A; The page number delivers the P1 mouth
LCALL RL245; The Chinese character serial number is multiplied by 32
SETB 24H,7; Because of memory located at monolithic integrated circuit system’s 7FFFH~0FFFFH
MOV DPH,24H
MOV DPL,25H
MOV R2,#32; Takes out 32 bytes continuously in this position
MOV R1,#0C0H
DPHZ2:MOVX A,@DPTR
INC DPTR
MOV @R1, A
INC R1
DJNZ R2, DPHZ2
MOV R1,#0C0H
MOV A, R6; According to the ranks layout count LCD indicator
MOV B,#16
MUL AB
MUL B,#30
MUL AB
ADD A, R5
MOV 25H, A
MOV R2, A
CLR A
ADDC A, B
MOV 24H, A
MOV R3, A
MOV 26H,#16; Will take out the lattice delivers the LCD demonstration
PRHZ6:MOV R4,#24H
LCALL PR1; Double byte parameter R2, R3
MOV A,@R1
MOV R3, A
INC R1
MOV R4,#0C0H
LCALL PR11; Single byte parameter R3
MOV A,@R1
MOV R3, A
INC R1
MOV R4,#0C0H
LCALL PR11
MOV A,#30
ADD A,25H
MOV R2, A
CLR A
ADDC A,24H
MOV R3, A
MOV 24H, A
DJNZ 26H, PRHZ6
RET
Note: As a result of the above procedure quoted from the following application example, transfers when the above procedure please do let the register group directly located at the 2nd area, namely R0 corresponds 10H.
Third, application example
Our application this article introduced the method has carried on some medical instrument’s design successfully. This design requirements have the complete Chinese and English character prompt and the Chinese character prescription demonstrated that and as far as possible will revise conservative for present’s function expansion and the prescription. At present in the instrument uses Chinese character approximately 1200, about sentence behavior 1300 lines, moreover the user thought that advantage employing labor controls the PC machine designed cost to be excessively high, the request reduces the cost as far as possible. Obviously, carries on the design regarding this system using the traditional Chinese character processing mode, although can save certain storage space, but the huge Chinese character and the sentence code the work actually to let the human be awed at the sight, moreover, when the prescription revises must use the new Chinese character is quite troublesome. We use the method which 8031 monolithic integrated circuit systems and this article introduced to carry on the design, the entire hardware circuit and the first floor programming has only used 1 week-long time, reduced greatly has opened the cycle. Moreover because this system may transfer all ASCII code and the complete Chinese character storehouse, therefore is very convenient regarding the function expansion and the prescription revision.