As an important display method, LED dot matrix has been widely used. An important problem that needs to be solved in the dot matrix display system program controlled by single chip microcomputer is the acquisition of character dot matrix data, which is often called font extraction. The author also encountered this problem in the work process. After learning and research, it was found that the commonly used method of font extraction is to use special font extraction software to complete it, but it also encountered the problem that the dot matrix size is fixed and cannot be selected at will. For example, in the program for controlling 5×7 LED dot matrix, it is impossible to find suitable software to obtain the font. After research and experiments, it was found that the use of Excel software can achieve font extraction of any dot matrix size.
The core idea of this method is to apply Excel's "conditional formatting" function. Select any cell in the Excel table, use "conditional formatting" in the "format" menu, and set the cell format to black background when the cell value is equal to 1, as shown in Figure 1. After the setting is successful, you will find that when the value in the cell is 1, the cell will turn black. Using this function, you can vividly display the dot matrix font display effect in Excel. In Excel, select a table area that is the same size as the dot matrix to be modulated. One cell represents one LED. Set the column width to 2. Set the conditional format for each cell in this area, and fill 1 in the cell corresponding to the LED to be lit. Then you can get a graphic similar to the display effect. As shown in Figure 2, the effect of displaying the number "1" in a 5×7 dot matrix. Then you can use the Excel formula function to calculate the data of the corresponding rows and columns to get the dot matrix data. For easy reading, the row and column labels are added on the left and top respectively. The right side is the font data of each row, and the bottom is the font data of each column.
After loading Excel's "Analysis ToolPak" macro, you can use the DEC2HEX() function to convert decimal to hexadecimal, and use the TEXT() function to convert it to a two-digit character, and then use the & operator to add H after it to get the hexadecimal data format commonly used in microcontroller programs. Corresponding to the Excel table area position of Figure 2, the formula for the font data of the first row showing "1" in the 5×7 dot matrix is: =TEXT(DEC2HEX(B2+C2*2+D2*4+E2*8+F2*16), "00")&"H", and the result is 04H; the formula for the font data of the first column is: =TEXT(DEC2HEX(B2+B3*2+B4*4+B5*8+B6*16+B7*32+B8*64), "00"&"H", and the result is 00H. The formulas for other rows and columns are analogous. Similarly, the & operator can be used to combine the font data into the data table format of the single-chip microcomputer program. As shown in Figure 2, the formula for the 10th row is: ="DB"&B9&", "&C9 &", "&D9&", "", "&E9 &", "&F9, and the result is "1". The font data taken by the 5×7 dot matrix according to the column is DB 00H, 42H, 7FH, 40H, 00H; the formula for the 11th row in Figure 2 is: = "DB"&G2&", "&G3 8L", "&G4&", "&G5 &", "&G6&", "&G7&", "&G8, and the font data of the 5×7 dot matrix of "1" taken by row is DB04H, 06H, 04H, 04H, 04H, 04H, 0EH, and the font data in the microcontroller assembly language data table format is successfully generated and can be directly copied to the microcontroller program for use.
By extending this method, you can also use the seven-segment digital tube to calculate the glyph code in Excel. As shown in the 9th row of Figure 3, the formula for calculating the glyph code of the seven-segment digital tube is: =TEXT(DEC2HEX(C2+D3*2+D5*4+C6*8+B5*16+B3*32+C4*64), "00")&"H", and the glyph code of the seven-segment digital tube for "2" is 5BH.
In this method of using Excel to extract fonts:
① The high and low bit order problem of dot matrix extraction can be modified by adjusting the bit weight of each bit in the cell calculation formula.
② When extracting fonts with dot matrices of different sizes, the 5×7 dot matrix in the text can be used as an analogy. Draw the corresponding size area and modify the number of cells calculated by the formula to achieve this.
③ In this method, if the conditional format is set to "When the cell value is equal to 1, the cell format is black background", then calculate and find the font code.
The display result is a common cathode digital tube font code, that is, the bright field is 1. If a common anode digital tube font code is required, that is, the bright field is 0, set the conditional format to "When the cell value is equal to 0, the cell format is black background", and enter 1 in the position that does not need to be lit. The formula remains unchanged to achieve this.
Reference address:Method of Extracting Fonts from Excel Software in Single Chip Microcomputer Application
The core idea of this method is to apply Excel's "conditional formatting" function. Select any cell in the Excel table, use "conditional formatting" in the "format" menu, and set the cell format to black background when the cell value is equal to 1, as shown in Figure 1. After the setting is successful, you will find that when the value in the cell is 1, the cell will turn black. Using this function, you can vividly display the dot matrix font display effect in Excel. In Excel, select a table area that is the same size as the dot matrix to be modulated. One cell represents one LED. Set the column width to 2. Set the conditional format for each cell in this area, and fill 1 in the cell corresponding to the LED to be lit. Then you can get a graphic similar to the display effect. As shown in Figure 2, the effect of displaying the number "1" in a 5×7 dot matrix. Then you can use the Excel formula function to calculate the data of the corresponding rows and columns to get the dot matrix data. For easy reading, the row and column labels are added on the left and top respectively. The right side is the font data of each row, and the bottom is the font data of each column.
After loading Excel's "Analysis ToolPak" macro, you can use the DEC2HEX() function to convert decimal to hexadecimal, and use the TEXT() function to convert it to a two-digit character, and then use the & operator to add H after it to get the hexadecimal data format commonly used in microcontroller programs. Corresponding to the Excel table area position of Figure 2, the formula for the font data of the first row showing "1" in the 5×7 dot matrix is: =TEXT(DEC2HEX(B2+C2*2+D2*4+E2*8+F2*16), "00")&"H", and the result is 04H; the formula for the font data of the first column is: =TEXT(DEC2HEX(B2+B3*2+B4*4+B5*8+B6*16+B7*32+B8*64), "00"&"H", and the result is 00H. The formulas for other rows and columns are analogous. Similarly, the & operator can be used to combine the font data into the data table format of the single-chip microcomputer program. As shown in Figure 2, the formula for the 10th row is: ="DB"&B9&", "&C9 &", "&D9&", "", "&E9 &", "&F9, and the result is "1". The font data taken by the 5×7 dot matrix according to the column is DB 00H, 42H, 7FH, 40H, 00H; the formula for the 11th row in Figure 2 is: = "DB"&G2&", "&G3 8L", "&G4&", "&G5 &", "&G6&", "&G7&", "&G8, and the font data of the 5×7 dot matrix of "1" taken by row is DB04H, 06H, 04H, 04H, 04H, 04H, 0EH, and the font data in the microcontroller assembly language data table format is successfully generated and can be directly copied to the microcontroller program for use.
By extending this method, you can also use the seven-segment digital tube to calculate the glyph code in Excel. As shown in the 9th row of Figure 3, the formula for calculating the glyph code of the seven-segment digital tube is: =TEXT(DEC2HEX(C2+D3*2+D5*4+C6*8+B5*16+B3*32+C4*64), "00")&"H", and the glyph code of the seven-segment digital tube for "2" is 5BH.
In this method of using Excel to extract fonts:
① The high and low bit order problem of dot matrix extraction can be modified by adjusting the bit weight of each bit in the cell calculation formula.
② When extracting fonts with dot matrices of different sizes, the 5×7 dot matrix in the text can be used as an analogy. Draw the corresponding size area and modify the number of cells calculated by the formula to achieve this.
③ In this method, if the conditional format is set to "When the cell value is equal to 1, the cell format is black background", then calculate and find the font code.
The display result is a common cathode digital tube font code, that is, the bright field is 1. If a common anode digital tube font code is required, that is, the bright field is 0, set the conditional format to "When the cell value is equal to 0, the cell format is black background", and enter 1 in the position that does not need to be lit. The formula remains unchanged to achieve this.
Previous article:Data acquisition and wireless transceiver system based on ADuC841
Next article:Application of S3C44B0 in high-precision DC switching power supply
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Power Management Articles
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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)
- Learn ARM development(15)
Guess you like
- 【Iprober 520 Current Probe】Evaluation Report (Part 3) Practical Circuit Application
- HDMI to DP with 5V power supply adapter board design circuit diagram
- [Flower carving hands-on] Interesting and fun music visualization series of small projects (25) - water tornado vortex lamp
- New review! Zhongke Yihai Micro-Shenzhen series FPGA development board EQ6HL45 is here!
- 【GD32E231 DIY】RTC Development
- Fluke Award-winning Live Broadcast | Basics of Data Loggers, Their Applications and Calibration
- Regarding power supply, let me share a particularly inspiring story...
- Embedded Systems Basics: Understanding Embedded Systems
- [FM33LG0 Series Development Board Review] 06.CAN
- EEWORLD University - Isolated Gate Driver Challenges and Solutions