Http://display.ofweek.com/2009-04/ART-230005-8300-28412943.html
LCD is the most important channel for human-computer interaction. LCD not only displays text information but also waveform information. Therefore, it is essential to compile a complete set of function libraries, it should include a series of functions such as displaying ASCII codes, strings, integer numbers, floating point numbers, Chinese characters, painting points, and draw lines.
The establishment of upper-layer functions is inseparable from the underlying drivers. The underlying drivers should be based on the basic sequence and instructions of liquid crystal. 1. It is the basic sequence of the LCD module.
Figure 1 basic sequence diagram of the dmf5001 Liquid Crystal Module
Based on the time sequence diagram and control commands, it is not difficult to write basic read/write functions. These functions are the basis for building the upper layer. Then, you must understand the basic display and filling methods of liquid crystal. 2. It is the ing between the buffer zone of the LCD module and the display screen. The t6963 control chip has a buffer of 64 KB, which can be divided by programs into three types of Buffers: graphics, text, and text features. Different data is written in different buffers, and corresponding information is mapped on the LCD screen, this is how the LCD module displays information.
Figure 2 LCD ing mode of dmf5001
Because t6963 contains an ASCII font, to display character information, you only need to enter the corresponding information in the text area.
If you want to display Chinese characters or graphics, you must first build a model in the ROM area of the microcontroller, and then write the information into the graphics buffer area of the LCD, under the control of the LCD control module, the corresponding information is mapped to the display, that is, the Chinese character or graphic information we see.
If you want to display the waveform map collected by ad in real time and the spectrum map after FFT processing, the technologies used for dynamic waveform display will be described in detail here.
(1) display of points
The display of waveforms is inseparable from the display of "points". The so-called "Point-to-line" makes sense. For liquid crystal with only two gray levels of black and white, to draw a "point" is to light up a pixel. Therefore, based on the time sequence diagram, we first establish the underlying function that displays "points" on the LCD screen. Draw "points" on the LCD screen. There are two points to note: one is the size of the buffer space, and the other is the filling method of pixels. In the dmf5001 LCD module, "points" must be drawn in the graphic buffer zone. For a 160x128 pixel display, the graphic buffer occupies a total of (160x128)/8 = 2560 bytes of space. Each byte corresponds to an address, that is, a total of 2560 addresses. Considering that the filling mode of the dmf5001 image is top-to-bottom horizontal filling, and the control command itself supports the control of the brightness of a pixel. Therefore, it is easy to control the brightness of a certain point on the LCD screen based on the buffer address, that is, the so-called "dot.
(2) Coordinate System Establishment
The display of waveforms involves Displaying Multiple vertices in sequence. The display positions of the first and second vertices must be determined, because only in this way can the changes of the displayed waveforms be measured. Therefore, it is necessary to create a reference coordinate system on the LCD screen. Since the graphic buffer and the points on the LCD screen are mapped one by one, we may first plan a coordinate system on the LCD screen based on our thinking habits, and then based on the coordinate values of the coordinate system, then it is reflected in the actual buffer zone. In this way, we can display the "point" Information on the corresponding address on the LCD screen based on the reflected address. As shown in figure 3.
Figure 3 ing between the LCD coordinate system and the graphic buffer address
(3) Formation of dynamic waveforms
The waveforms we see on the LCD are dynamic. That is to say, the waveforms should be continuously changing. This involves the number of scanned frames. We know that the visual duration of the human eye is 0.1 s, that is to say, if the image changes for 25 consecutive times (frames) within one second, the whole process looks "dynamic. For the waveform display of this work, the higher the number of frames, the better the real-time performance. When there are more than 25 frames, there is no obvious waveform refresh process. However, due to the limited speed of the actual controller and the large amount of computing in the whole process, as long as the update rate of 4 to 5 frames can be ensured, the requirements can be met. Of course, this is at the cost of real-time performance.
Waveform refresh is easy to implement in software. Because the coordinate system has been established, the size of the display area is known. Once a display area is filled with data, immediately clear the area. In this way, a frame scan is completed, and the displayed waveform data is "flashing.
(4) Reasonable quantification of display data
If the data collected by the ad module is directly sent to the graphic buffer zone for display without processing, the display effect is very poor. This is because the height and width of the LCD screen are limited, that is to say, the visible area of the screen is limited. In addition, we have manually defined the coordinate system, and the actual displayed data may "overflow" the coordinate system. This requires us to reasonably narrow (or enlarge) the data collected by AD Based on the length and width of the coordinates. 4.
Taking this design as an example, the coordinate pumping plan for the original waveform display area of the LCD screen is as follows: X axis has 128 units (pixels), Y axis has 64 units (pixels), for 10-bit ad, if the maximum voltage signal value is collected and the ad value of 1023 is obtained, in order to display this signal point in the display area, the ratio of 1024/64 to 16 times is reduced. If the measurement is too small and the display is not obvious, we can also zoom in proportionally. If the corresponding information is displayed on the screen, it is equal to the scaling extension of the display area, we can get an optimal display ratio through reasonable calculation, which is the technical prototype of the Automatic Waveform adjustment function on the Digital Storage Oscilloscope.
Figure 4 reasonably quantified data
(5) Optimize the Display Effect
The AD values after proportional reduction are discrete. If the AD values are directly displayed on the screen, discrete points are displayed, and the visual effect is also poor, therefore, it is necessary to perform interpolation compensation for these discrete points to smooth them continuously. There are many interpolation compensation algorithms, and different algorithms bring different compensation accuracy. Here we introduce the simplest method of compensation: each time a point is displayed, use variables to record the coordinate information of the point. When the next point is displayed, compare the difference between the two coordinates. Use the tracking method to complete the difference between the two coordinates, it means that the two points are connected by a wire, and the waveform looks much smoother. As shown in figure 5.
Figure 5 effects of waveform Optimization
(6) Implementation of horizontal axis rolling on Time Scale
According to the actual design requirements, in order to facilitate the reading of waveform data, a time axis that can scroll left and right is also designed. The implementation principle is to display the custom ASCII characters in the hour area respectively (here is the time axis composed of the "|" line) and the waveforms displayed in the graphic area are displayed on the LCD screen. In this way, the two types of information are displayed in two types of buffer operations without mutual interference, the specific information can be obtained through the previously defined Coordinate System Conversion. The necessity and convenience of defining the coordinate system are also displayed here. The entire process is shown in Step 6.
Figure 6 Implementation of horizontal axis Scrolling on Time Scale
This design has compiled a complete set of graphic functions for the dmf5001 LCD module, fully meeting the display needs. A small clear icon is used to represent text information and improve the friendliness of the entire interface. The following are some actual display results.
Figure 7 Waveform Display