With the development of science and technology, ARM is applied more and more widely in all aspects of society. ARM chips are widely used in wireless products, PDAs, GPS, networks, consumer electronics, STBS and smart cards. The LPC2138 is a Philips ARM7TDMI-based RISC microprocessor with a main frequency up to 50MHz. Liquid crystal display (LCD) is a man-machine interface reflecting system input/output in embedded system. LCD is widely used for its micro-power consumption, small volume, rich display content, modularity, simple interface circuit and many other advantages. In this paper, on the basis of introducing the pin structure and function of LM016L LCD module with HD44780 as the controller, the hardware interface circuit of LM016L and Lpc2138 chip is built, the display program is written with c language, and the function simulation is carried out with Proteus software.
1 Brief introduction of the structure and function of the LCD module
The LM016L LCD module uses the HD44780 controller. HD44780 has a simple and powerful instruction set, which can realize character movement, flashing and other functions. The HD44780 controller consists of two 8-bit registers, an instruction register (IR) and a data register (DR), a busy flag (BF), a display data RAM(DDRAM), a character generator ROM(CGROM), a character generator RAM(CGRAM) and an address counter (AC). IR is used for storing instruction code, which can only be written but not read; DR Is used to store data, which is automatically written to DDRAM and CGRAM by internal operations, or to temporarily store data read from DDRAM and CGRAM. When BF is 1, the LCD module is in internal processing mode and does not respond to external operation instructions or accept data. DDRAM is used to store displayed characters and can store 80 character codes. CGROM generates 160 kinds of 5 x 7 dot matrix characters and 32 kinds of 5 x 10 dot matrix characters from the 8-bit character code, 8-bit character encoding and character correspondence. CGRAM is reserved for special characters written by the user and has a capacity of only 64 bytes. You can customize 8 5 x 7 dot matrix characters or 4 5 x 10 dot matrix characters. The AC can store DDRAM and CGRAM addresses. If the address code is written to the IR with the instruction, the IR automatically loads the address code into the AC and selects either DDRAM or CGRAM units.
2 Liquid crystal module simulation based on Proteus ISIS 7
2.1 Interface PCB design
Run Proteus ISIS 7 to enter the PCB design interface, and select required components according to the component library. The P0.0-P0.7 ports of lpc2138 are used as the output end of 8-bit data, and P0.8, P0.9 and P0.10 are used as the output end of control signals. The completed circuit is connected.
2.2 Software PCB design
After the circuit diagram is drawn, you can write the driver program of LM016L. There are two types of LM016L operations: read operations and write operations. In general, there is no need to read data from the liquid crystal, so the liquid crystal operation is mainly write instructions and write data two write operations, for the busy flag (BF), query method, to ensure that the liquid crystal module has enough time for internal data processing. When writing the source program, it is necessary to write the program according to the timing diagram of the liquid crystal module.
Define pins according to circuit diagram 1: RS BIT P0.8; RW BIT P0.9; LCD E BIT PO. 10.
The development environment of this PCB design is keil uvision3. The program is roughly divided into three parts: initialization, control information and data transmission. Here is a brief explanation of the combination of the program source code:
The HEX file is generated after keil software is compiled. Open the lpc2138 chip property dialog box in Proteus, load the generated HEX file into it, and then run the simulation, and you can see the result in Figure 3, indicating that the PCB design is successful.
3 Closing remarks
The simulation of ARM7+LM016L LCD module is realized by Proteus, and the string display is realized. Proteus provides a good software platform for ARM learning, so that beginners can discard some details of circuit PCB design, quickly master the core content of ARM. At the same time, this method does not need hardware resources, which is also a best way for schools to open ARM courses.