LCD control and touch screen interface design based on W77E58

Publisher:平静心境Latest update time:2014-02-26 Source: elecfansKeywords:W77E58 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    0 Introduction

  With the widespread application of embedded systems, a large number of 16-bit and 32-bit embedded processors have emerged. The traditional 8-bit microcontroller has been used in production practice for a long time, with mature manufacturing technology and more reliable performance, and still occupies a considerable market, especially in the field of automotive electronics and other fields with extremely high reliability requirements. The LCD display module has the advantages of rich display information, low power consumption, small size, light weight, and no radiation.

  As a special computer peripheral, touch screen is the most natural and convenient way of human-computer interaction. T32QM 6450 LCD module is a TFT color LCD display with touch screen function, with a resolution of 240×320 and supports 2.6×105 color display. It has powerful functions, easy use, simple interface, rich special control instructions, and can easily realize functions such as screen scrolling display and touch screen.

  1 T32QM6450 LCD module structure

  T32QM 6450 is a liquid crystal module, mainly composed of TFT-LCD display, LED backlight, touch screen, source driver IC IS2102 and gate driver IC IS2202. Source Driver is responsible for providing driving voltage for each pigment point on the column, while Gate Driver controls the strobe state of each row of pixels. Each pixel of TFT liquid crystal is driven by a thin film transistor integrated behind the pixel, so that screen information can be displayed at high speed, high brightness and high contrast, and the display grayscale can be accurately controlled. LCD is connected to the processor through the bus to realize the transmission of data and instructions.

  2 T32QM6450 and W77E58 interface circuit

  The hardware connection is shown in Figure 1. The processor chip is W77E58. This chip is a fast 8051 compatible microcontroller. Its core has been redesigned to improve the clock speed and memory access cycle speed. Its instruction set is basically the same as that of 8051, with an additional DEC DPTR instruction. 8051 has one machine cycle for every 12 clock cycles, while W77E58 has one machine cycle for every 4 clock cycles, which improves the instruction execution speed. In addition, W77E58 can also adjust the cycle of MOVX instruction, ranging from 2 to 9 machine cycles. This design enables W77E58 to access slow or fast external RAM and peripherals more effectively.

   201242410523210074.jpg

 

  Figure 1 LCD screen and W77E58 hardware connection circuit

  Because W77E58 is a high-speed 8-bit microcontroller, and the LCD module uses a 16-bit bus interface, two latches 74HC573 are used in the circuit, and the P24~P27 ports are used to control the latch enable and output enable pins LE (falling edge latch) and OE (low level valid) of the two latches respectively. First, give the LE of the first 74HC573 a high level, transmit the low 8-bit data through the P1 port, and then give the LE of the chip a low level to latch the current data; give the LE of the second chip a high level, and also transmit the high 8-bit data through the P1 port and latch it. Finally, give the OE of the two 74HC573s a low level at the same time to realize the transmission of 16-bit data.

  This system is a mixed voltage system. The LCD module and ADS7843 are powered by 3.3 V, while the processor and latch are powered by 5 V. These two parts cannot be directly connected. Therefore, the level conversion problem must be handled well. Four bidirectional level conversion chips 74LVC4245 are used in the circuit, which can realize the mutual conversion between 3.3 V and 5 V.

  To realize the touch screen function, a touch screen controller ADS7843 is used in the circuit. It is a resistive touch screen control chip with serial 12-bit A/D conversion function. In the off mode, the power consumption is only 0.5uW, and in the 12 V, 125 kHz working mode, the power consumption is 750uW3. This article only introduces the main functions in combination with the circuit. CS is the chip selection terminal; DCLK is the clock input terminal, which is input by the software analog clock signal of the P20 pin; DIN is the data serial input terminal, and the control data is input through this pin; X+, Y+, X-, Y- are the contact point coordinate data input terminals; INT is the interrupt pin, which is used to notify the MCU that a touch event has occurred, and DOUT serially outputs the converted touch position data to the MCU. [page]

  3 LCD display programming

  3.1 Reading and writing instructions and data

  By setting the RS pin of the LCD module to 1 or 0, data or instructions can be transmitted between the processor and the LCD. When RS=1 is set, the data signal is transmitted; when RS=0 is set, the instruction signal is transmitted. The data received by the D8~D15 port of the module (i.e. the high 8 bits) represents the register number, and the control instruction is received by D0~D7. Some subroutines are as follows:

   201242410523265473.jpg

  

  3.2 Display of characters, Chinese characters and colors

  The above subroutine can be called to conveniently send control commands and color information to the LCD module. The T32QM 6450 module has a total of 158 registers. By calling the WriCom function, control commands can be written to the relevant registers, and then calling WriData to write 2 bytes of color information, the RGB format of which is: red is the upper 5 bits (Bit15~Bit11), green is the middle 6 bits (Bit10~Bit5), and blue is the lower 5 bits (Bit4~Bit0). After the above operations, colors, characters, images, etc. can be displayed at the specified position or area. If you want to display a character or Chinese character in color Color at the point with coordinates (X, Y) on the screen, as long as you know its dot matrix array, call WriData (Color) at each point to be displayed. The display principle of the picture is similar. Use the conversion tool to convert the picture into a C format array file. The following example is a program to display characters:




   20124241052321353.jpg

3.3 Scrolling display screen

  To achieve the scrolling display effect of the screen in the specified area, you can set registers R75~R80, where registers R75 and R76 are used to set the starting line of the scrolling area; R77 and R78 set the range of the screen, that is, the number of lines to be scrolled; R79 and R80 set the number of lines to scroll each time, that is, the step length. It should be noted that the step length setting is not a one-time thing, because the step length here is relative to the state when the scroll screen is initialized, not relative to the last scrolling action. Figure 2 illustrates the scroll screen setting and demonstration effect.

   2012424105232849910.jpg

  

  Figure 2 Scrolling settings and process demonstration

  The C program for the process shown in Figure 2 is as follows:

   201242410523284991.jpg

 , the screen scrolls faster and the effect is not obvious.

  In actual application, the timer can be combined to change the values ​​of registers R79 and R80 at regular intervals. Generally, the values ​​are assigned according to an increasing arithmetic progression, which can achieve a good visual effect. The maximum value assigned cannot exceed 319, because the screen has a maximum of 320 lines; when the assigned value is 319 and the values ​​assigned to R75 and R76 are 0, the full-screen scrolling display can be achieved.

  4 Conclusion

  After the display system is debugged, it can display longitude, latitude, time and other signals in real time through the serial port and GPS module, and the display effect is good. The formal parameters of the subroutine given in this article are mostly 2-byte integer values, which can be directly used in 16-bit and 32-bit microcontrollers, with strong compatibility, and provide a method for its application in portable systems.

Keywords:W77E58 Reference address:LCD control and touch screen interface design based on W77E58

Previous article:Using a Remote Control to Make a Crystal Oscillator Frequency Tester
Next article:TTL watchdog circuit

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号