1. The principle of Chinese character display:
Let's take the UCDOS Chinese Song font library as an example. Each character is displayed by a dot matrix of 16 rows and 16 columns. That is, each character in the national standard Chinese character library is represented by a 256-dot matrix. We can understand each dot as a pixel, and the shape of each character as an image. In fact, this Chinese character screen can not only display Chinese characters, but also display 256 pixels.
Any graphic within the range.
Let's take the Chinese character "大" as an example to illustrate the scanning principle:
In the UCDOS Chinese Song font library, each character is displayed in a dot matrix of 16 rows and 16 columns.
Controlled by the 8-bit AT89C51 microcontroller, since the microcontroller's bus is 8 bits, a word needs to be split into two parts.
Generally, we divide it into the upper part and the lower part. The upper part is composed of 8*16 dot matrix, and the lower part is also composed of 8*16 dot matrix.
In this example, the microcontroller first displays the upper half of the first column in the upper left corner, that is, the port p00---p07 in the 0th column. The direction is p00 to p07. When the Chinese character "大" is displayed, p05 lights up. From top to bottom, p0.0 turns off, p0.1 turns off, p0.2 turns off, p0.3 turns off, p0.4 turns off, p0.5 turns on, p0.6 turns off, and p0.7 turns off. That is, the binary number 00000100 is converted to hexadecimal 04h.
After completing the first column of the upper half, continue to scan the first column of the lower half. For the convenience of wiring, we still design it to scan from top to bottom, that is, scan from p27 to p20. From the above figure, you can see that this column is all dark, that is, 00000000, which is 00h in hexadecimal.
Then the MCU turns to the second column in the upper half, and p05 is still lit, which is 00000100, or hexadecimal 04h.
After this column is completed, the scan of the lower half continues, p21 lights up, and the binary value is 00000010, which is 02h in hexadecimal.
According to this method, continue the following scan, a total of 32 8-bit scans, you can get the Chinese character "大"
The scan code is:
04H,00H,04H,02H,04H,02H,04H,04H
04H,08H,04H,30H,05H,0C0H,0FEH,00H
05H,80H,04H,60H,04H,10H,04H,08H
04H,04H,0CH,06H,04H,04H,00H,00H
From this principle, we can see that no matter what font or image is displayed, this method can be used to analyze its scanning code and display it on the screen.
However, there are many ready-made Chinese character font generation software now, so we don’t have to draw tables and calculate codes ourselves.
After opening the software, input Chinese characters and click "Retrieve". The Chinese character code of the hexadecimal data will be automatically generated. Then copy the vertical data we need into our program.
We connect the row and column bus to the i0 port of the microcontroller, and then send the scan code analyzed above to the bus, and we can get the displayed Chinese characters. In this example, since there are 16 rows and 16 columns in total, if all of them are connected to the 89c51 microcontroller, a total of 32 io ports will be used, which will cause the exhaustion of io resources and the system will have no room for expansion. In actual applications, we use the 4-16 line decoder 74ls154 to complete the display in the column direction. The 16 lines in the row direction are connected to the p0 port and the p2 port.
Program Listing:
ORG 00H
LOOP: MOV A,#0FFH; boot initialization, clear screen
MOV P0,A ; Clear P0 port
ANL P2,#00; Clear P2 port
MOV R2,#200
D100MS: MOV R3,#250; Delay 100 milliseconds
DJNZ R3,$
DJNZ R2,D100MS
MOV 20H,#00H; get the initial value of the code pointer
l100: MOV R1,#100; the dwell time of each word
L16: MOV R6,#16; 16 codes per word
MOV R4,#00H ; Clear the scan pointer
MOV R0,20H; store the code pointer in R0
L3: MOV A,R4; scan pointer is stored in A
MOV P1,A ; Scan output
INC R4; Scan pointer plus 1, scan the next
MOV A,R0; store the code pointer in A
MOV DPTR,#TABLE ;Get the code of the upper half of the data table
MOVC A,@A+DPTR
MOV P0,A ; Output to P0
INC R0; add 1 to the code pointer and fetch the next code.
MOV A,R0
MOV DPTR,#TABLE; Get the code of the lower half of the data table
MOVC A,@A+DPTR
MOV P2,A; output to P2 port
INC R0
MOV R3,#02 ; Scan 1 millisecond
DELAY2: MOV R5,#248;
DJNZ R5,$
DJNZ R3,DELAY2
MOV A,#00H ; Clear the screen
MOV P0,A
ANL P2,#00H
DJNZ R6,L3; Are 16 codes for one word completed?
DJNZ R1,L16; Has the dwell time for each word reached?
MOV 20H,R0; store the code pointer in 20H
CJNE R0,#0FFH,L100; Are 8 words and 256 codes completed?
JMP LOOP; Repeated loop
TABLE :
; Code for the Chinese character “倚”
db 01H,00H,02H,00H,04H,00H,1FH,0FFH
db 0E2H,00H,22H,00H,22H,0FCH,26H,88H
db 2AH,88H,0F2H,88H,2AH,0FAH,26H,01H
db 63H,0FEH,26H,00H,02H,00H,00H,00H
; The following are the codes for Tian, Yi, Chu, Bao, Dao, Tu, Long, respectively, omitted.
end
The row direction of the circuit is scanned by ports P0 and P2. Since port P0 has no pull-up resistor, a 4.7k*8 resistor is connected to pull it up. If there is no resistor, 8 ordinary 4.7k 1/8w resistors can also be used. To provide load capacity, 16 2n5551 NPN transistors are connected to drive.
The column direction is scanned by a 4-16 decoder 74LS154, which is controlled by P1.0-P1.3 of 89C51. Similarly, the driving part is completed by 16 2N5401 transistors.
The circuit is powered by a LM7805 three-terminal regulator, which consumes about 100 mA of current.
Use a 12*20cm universal circuit board, and choose light-emitting tubes of better quality (otherwise there will be bad pixels, which are troublesome to replace). First, insert 256 light-emitting tubes into the circuit board, pay attention to the insertion direction, and make the height consistent. Solder them directly in the row direction and bridge them in the column direction. After completion, test them with a multimeter and replace any that do not light up.
Then find a data cable of a computer hard disk, cut the required length, and lead the row and column lines to the relevant pins of the circuit. For simplicity, the schematic diagram only shows the schematic diagram, only 2 transistors are drawn in the row and column directions, and only 4 light-emitting tubes are drawn on the screen. In fact, there are 256 light-emitting tubes, 16 transistors in the row and column directions, a total of 32. The welding process can be completed in one day. After compiling the program, burn it into 89c51, insert it into the 40pin Ic socket, and you can see the screen display in turn: "Yitian comes out with a sword to slay the dragon".
Of course, you can replace the Chinese character code part of the program with the code you need to display the Chinese characters you need.
The above picture is a photo of the actual object. Readers who are interested in this article can find his completed program in the accompanying CD of this issue of Radio Magazine, or download it from the author's website www.51c51.com.
name
|
quantity
|
Specification
|
4.7k 1/8w
|
32
|
resistance
|
4.7k*8 resistor
|
1
|
|
2n5551
|
16
|
Low power NPN transistor
|
2n5401
|
16
|
Low power PNP transistor
|
led
|
256
|
3mm white red high brightness
|
22P
|
2
|
Ceramic capacitors
|
10uf/50v
|
1
|
Electrolytic Capacitors
|
100uf/25v
|
2
|
Electrolytic Capacitors
|
AT89C51
|
1
|
or AT89S51
|
40pin IC socket
|
1
|
Plug in 89c51
|
12M
|
1
|
Crystal
|
74LS154
|
1
|
or 74HC154
|
LM7805
|
1
|
Voltage regulator IC
|
Power outlet
|
1
|
|
Power Supply
|
1
|
9-12V/200Ma regulated power supply
|
Universal circuit board
|
1
|
12*20(cm)
|
Previous article:Speedometer made by single chip microcomputer
Next article:Come with me to write the simplest single chip program
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- The relationship between pulse+, pulse- and U2B output is logical AND.
- Southern dumplings and northern dumplings, what do you eat during the Winter Solstice?
- About using the emulator to adjust the STM32 program
- Need to burn multiple firmwares for mass production? Just rely on this tool!
- SinlinxA33 development board wireless wifi settings
- Lora data analysis and data transmission to the cloud platform
- 【Visual Home Environment Analyzer】+ADI Smoke Sensor Appreciation
- NB-IoT and LoraWan technical analysis and prospects
- Which companies are the big manufacturers in the embedded field?
- Small IoT Project - Smart Agricultural Irrigation System