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 the calculation and calculation of the font code
will display the common cathode digital tube font code, that is, the bright field is 1. If you need
a common anode digital tube font code, 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, and the formula remains unchanged to achieve this.
Previous article:Design of portable human physiological parameter monitor
Next article:Micro-power consumption data acquisition system based on MSp430 single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- If you don’t understand millimeter wave, ask: the latest application of millimeter wave radar in automobiles
- The basic principles and effective use of RF directional couplers
- NXP Rapid IoT Review] +⑥NXP Rapid IoT self-exploration program, review summary and impressions
- RF Circuit PCB Design Processing Techniques
- RSL10-002GEVB Plant Manager Node Design
- Development environment preparation
- Random notes small total small picture signal reflection picture
- Basic knowledge of radome structure
- (Repost) Getting Started with Bluetooth Development
- [Shanghai Hangxin ACM32F070 development board evaluation] 5. Run the watchdog