0. Introduction
Dot-matrix flat-panel graphic LCDs are widely used in various portable products. There are many types of LCD controllers at the core of the display, and various control chips have differences in control circuit logic, control instructions, index parameters, etc. However, for flat-panel dot-matrix graphic LCDs that already have control circuits, users do not need to care about the integrated chip of its control core and several signals of the control circuit, and can easily use it for development.
1. Characteristics of ACM12864J LCD Module
ACM12864J is a small LCD module produced by United Electronics Corporation. The module is low-priced, has readable and writable data, has its own negative voltage generating circuit, single +5V power supply, backlight, can be directly controlled by various microcontrollers, data read and write operations are not controlled by an external clock, does not have a Chinese character library, has a duty cycle of 1/64, and has a total of 20 pins for external interface.
The data transmission method adopted by ACM12864J is vertical data transmission method. The 64 lines are divided into pages 0 to 7, with 8 lines per page, and displayed page by page. The steps of sending data are as follows: first send the first column of page 0, with the high bit at the bottom, which is one byte; then send the second column until the end of 128 lines; then send the first column of page 2, and so on, until the entire screen of data is sent. This data display method uses font extraction software and adopts the "vertical 8-point lower high bit" output format to extract the model. Without any modification, it can be displayed well. Its write timing is shown in Figure 1.
2. Hardware design of ACM12864J LCD display module application
ACM12864J data is an 8-bit parallel data interface, plus several control lines. If it is directly interfaced with a single-chip microcomputer, it will occupy too many lines. SPCE061A has a built-in SIO interface, which can be used to transmit 8-bit parallel data through serial-to-parallel conversion performed by 74HC164. In this way, even the backlight control signal line only occupies 8 I/O ports. If no read operation is performed, it can be reduced to 7 control signal lines. There are four interface modes for the SIO interface, namely, the address is 8-bit, 16-bit, 24-bit and no address interface. The interface with ACM12864J adopts no address transmission. After setting the register working state, data can be directly transmitted. The maximum transmission rate of the SIO interface of SPCE061A can reach 5Mb/S. The read and write control lines of the data are controlled by the I/O lines of the single-chip microcomputer, and the timing delay required by the LCD is directly controlled by the programmed bit operation function. When programming, there is no need to consider the time requirements of the SPCE061A and ACM12864J interface, which simplifies programming. The hardware circuit is shown in Figure 2.
3. Software Programming
3.1 SIO Initialization and Data Writing
SPCE061A single-chip microcomputer is a microcontroller with SOC system produced by Taiwan Lingyang Technology Co., Ltd. The controller has built-in A/D conversion, SIO port, etc. Before transmitting data, the serial peripheral device interface SIO of SPCE061A must initialize the SIO port control register. The SIO port control register P_SIO_Ctrl mainly sets the working mode of SIO port communication, including device address, transmission speed, read and write settings, function settings, etc. The SIO port data register P_SIO_Data is mainly responsible for receiving and sending data during the reading and writing process. The start control register P_SIO_Start of the SIO port is also a status control register. According to the status of P_SIO_Start, it is judged whether the data is received or sent.
SPCE061A does not provide bit operation instructions. When operating on a bit, in order not to affect the status of other bits, the "read-modify-write" method can be used, that is: first read the value of a certain bit, perform logical AND and logical OR operations, and then write it back to the current byte, which changes the status of the I/O port. To this end, write the bit operation functions Set_IOA_Bit (n, dir, attrib, buffer, data) and Set_IOB_Bit (n, dir, attrib, buffer, data) to solve the above problem. The parameters of the function are defined as follows: n-the number of bits for bit operation; dir, attrib, buffer-the attributes of bit operation; data-the data for bit operation. The procedure for transmitting data is as follows:
[page]
3.2 Display of ASCII characters
The most common method is to use font extraction software to extract fonts. This method is suitable under the condition of relatively few resources. The disadvantage is that it is more troublesome, needs to be changed back and forth, and is not easy to address. A more practical method is to make an ASCII font table and define it as a one-dimensional array. If there is an operation of digital variables in the program, the variables must be converted into characters for display. Therefore, first determine whether the displayed characters or numbers are numbers. If they are numbers, they should be converted into characters first. Then subtract 32 from the ASCII value to get the index value, and directly look up the table according to the index value to find the 8*16 dot matrix font and send it out for display. In the program, variables can be used to directly represent numbers and perform operations, and only variables are sent when displaying. For SPCE061A, there is a built-in 32K word flash ROM, and the table is not large. Add "const" before the array to store the array in the internal flash ROM. In ACM12864J, each ASCII font is 8*16, each ASCII font occupies 16 bytes, and is arranged in ascending order of ASCII to facilitate searching.
3.3 Display of Chinese characters
There are generally two modes of Chinese characters on ACM12864J: one is 12*12 dot matrix, which can display 5 lines of Chinese characters, but the disadvantage is that programming is more difficult; the other is 16*16 dot matrix, which can display 4 lines of Chinese characters and is relatively simple to program. Taking 16*16 dot matrix as an example, each Chinese character occupies 32 bytes. According to the requirements of LCD display, using font extraction software, the "vertical 8-dot lower high position" can meet the requirements.
When designing a Chinese menu, 8 Chinese characters can be displayed per line. There is a "focus" problem. When programming, a "focus pointer" can be set. The ones under focus are highlighted, and the others are displayed normally. In this way, each line of display can be compiled into a function to control the focus, and the display line sub-function is called once when displaying. The Chinese character display program is as follows (fb=1, highlighted):
3.4 Display of graphics and animations
Graphics and animations are usually displayed on the entire screen. You can use the brush tool under Windows to select fonts. Create a 128*64 pixel picture, edit it, and save it as a black and white image. Then open it in the font software and extract the font. Each picture takes up 128*8 bytes of space. According to the characteristics of image data storage, the extracted adjacent font data is the same. If there are many pictures or animations are displayed, it is best to compress and save them to save valuable controller resources. When reading, write the controller software to decompress.
3.5 Curve Display and Drawing
Points are the basic units that make up a curve. Drawing a curve means calling point functions multiple times to display it. The idea of compiling point functions is to determine a point based on the horizontal coordinate X (1<=X<=128) and the vertical coordinate Y (1& lt;=Y<=64). When drawing a function, the X coordinate is from left to right, which just fits people's habits. But the Y coordinate increases from top to bottom, which is opposite to people's habits, so it must be corrected. Taking the drawing of a two-cycle sine function as an example, you can include the header file "math.h" and call the library function y=sinf(x), where x is a floating point radian display and the value of y is between -1 and 1. To display it on the full screen, you must add 1 to become positive and magnify it 31 times; the x coordinate is 128 points, and the step size is 0.1 radians. You can refer to the following program:
4. Conclusion
This article introduces the interface technology between ACM12864J and SPCE061A without Chinese character library, and proposes a skillful programming solution. Using ACM12864J LCD display module, it can display characters, Chinese characters, graphics and animations, etc., which improves the visual interface of the system and has been widely used in industrial instruments. SPCE061A produced by Lingyang Company has not only the functions of general controllers, but also its unique voice processing function, which can develop many intelligent products.
References
[1] Shenzhen United Electronics Company LCD Display Module ACM12864J User Manual
[2] Lingyang Technology Co., Ltd. μ'nSPTM MCU [R]. 2001
[3] Xue Junyi et al. Lingyang 16-bit MCU Principle and Application. Beijing University of Aeronautics and Astronautics Press, 2003
Previous article:A Method of Real-time Data Monitoring Using VB6.0 Digital Oscilloscope Single Chip Microcomputer
Next article:Hardware and software interface technology and its application for single chip microcomputer controlled mobile phone
Recommended ReadingLatest update time:2024-11-17 03:03
- Popular Resources
- Popular amplifiers
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
- BearPi-HM Nano 3 + Analysis of source code writing process under vscode
- STC15W104 power-off wake-up can not be done, please help
- Shift register based frequency divider
- DSP C6000 Architecture
- Wanted: Car air conditioning sensor
- Application of millimeter wave radar technology in barriers
- (Bonus 3) GD32L233 Review - Unboxing and showing off the big box
- CPLD
- The silk screen is AA6B SOT23-6 package with 2.2UH inductor 3.7~4.2V boost to 5V
- Add uart6 driver