South Korea ’s Samsung 320 × 240 LCD LCD module is a low-cost, high-quality LCD module with high resolution (point 0.27mm × 0.27mm), high contrast FSTN, high reliability, low power consumption, low price, etc. Especially suitable for CNC machine tools, PDAs, handheld computers, game consoles and other products. SED1335 is a liquid crystal display controller produced by SEIKOEPSON of Japan, which is very powerful among similar products. Its characteristics are: I / O buffer with strong function; rich command function; four-bit data parallel transmission; mixed display of graphics and text. SED1335 instruction set SED1335 has 13 instructions, most of which have parameters. The parameter value is set by the user according to the characteristics and display needs of the liquid crystal display module controlled. The instruction table is shown in Table 1. The SED1335 LCD control board is a control interface board used between the MPU system and the liquid crystal module. It receives commands and data from the MPU system and generates the corresponding timing and display of the data control module. A0 is the LCD controller register selection input, similar to the RS or D / I of the usual character dot matrix LCD module. The MPU writes the instruction code into the instruction input buffer (ie A0 = 1), and the parameter data of the instruction is then written through the data input buffer (A0 = 0). One of the functions of the instruction code with parameters is to select the corresponding parameter register. Except for SLEEPIN, CSRDIR, CSRR and MREAD, the execution of any instruction is generated after the input of the auxiliary parameters is completed. The MPU can effectively write new parameters and the remaining old parameters into new parameters. It should be noted that the order of the written parameters cannot be changed or omitted. Table 1 SED1335 instruction set Features | instruction | Code | Explanation | Parameter | System control | SYSTEM SET | 40H | Initialize, display window idle operation | 8 | | SLEEP IN | 53H | | - | Display operation | DISP ON / OFF | 59H / 58H | Set switch, set display mode | 1 | | SCROLL | 44H | Set display area, scroll | 10 | | CSRFORM | 5DH | Set cursor shape | 2 | | | | | |
The hardware interface circuit generally has a jumper on the SED1335 control board, which is used to select whether the MPU is MCS51 or MC68000 microcontroller. Here the hardware design uses the single chip microcomputer 80C31 to control SED1335 to complete the control of the LCD module. The interface circuit diagram is shown in Figure 1. 80C31 externally expands the 32K 27256 EEPROM to store programs and display data. The eight-bit data D0 ~ D7 of the LCD are connected to the external data bus P0.0-P0.7 of 80C31, the chip select CS of LCD is connected to P2.7 (A15) of 80C31, and the A0 of LCD is connected to P2.0 (A8 of 80C31) ), So the LCD port address is 0XXXXXX0XXXXXXXXB or 0XXXXXX1XXXXXXXXB, V0 is the contrast adjustment of the LCD, connected to a 20K potentiometer middle tap, when adjusted to the VEE direction, the LCD contrast increases, when adjusted to the VDD direction, the LCD contrast decreases . The program design of the software SEED1335 is very simple and convenient, and its process is: After the hardware system is powered on and reset, the software sets the parameters of each command to initialize the system according to the parameters of the LCD module (such as the number of rows, columns, and scanning frequency of the LCD) and the required display mode. After that, the data can be directly accessed by the microcontroller SED1335 display buffer, SED1335 can control the LCD display. If you need to change the display format later (such as flipping the original still picture), as long as you change the parameters of the corresponding command corresponding to the commands in Table 1, and then re-enter the data, you can change the display mode. The method to set the system command parameters or send data to the display mode is: first send the command code to the command port address of SED1335, and then send the command parameters to the data port address to send the data to the data port address. The syntax is as follows: MOV DPTR, #XXXXH; XXXXH is the command port or data port address MOV A, #XXH; XXH is the instruction code, code parameter, data MOVX @DPTR, A Software initialization is to set some parameters related to the LCD according to the instruction set provided in Table 1, so that the LCD can correctly display graphic information. For the 80C31, all instructions for LCD operations are to access external I / O instructions MOVX. For example, to display a 320 × 240 black and white bitmap, first invert the bitmap, burn bmp.hex and the program into 27256, and store the bitmap at an address starting at 1000H. The initialization procedure for the overlay display of 320 × 240 LCD dot matrix three-layer graphics is as follows. INIT: MOV DPTR, # 0101H; Command 40H parameter setting, # 0101H is the command port address MOV A, # 40H MOVX @DPTR, A; send the command code to the command port address MOV A, # 30H MOV DPTR, # 0000H; # 0000H is the data port address MOVX @DPTR, A; send the parameters to the data port address MOV A, # 07H; set the cursor width to 8 MOVX @DPTR, A MOV A, # 07H; set the cursor height to 8 MOVX @DPTR, A MOV A, # 27H; set the number of bytes required for each line of the LCD, 320 dots per line, the number of lines is 320 / 8-1 = 39 MOVX @DPTR, A MOV A, # 36H; set the scanning frequency of the LCD to about 70HZ MOVX @DPTR, A MOV A, # 239D; set the number of LCD columns to 239 MOVX @DPTR, A ... MOV DPTR, # 0101H; command 5AH, set point unit scroll position parameter MOV A, # 5AH MOVX @DPTR, A MOV DPTR, # 0000H MOV A, # 00H; send the number of moving digits in the horizontal direction parameter 0 MOVX @DPTR, A; No need to move MOV DPTR, # 0101H; Command 4CH, set cursor movement direction parameter MOV A, # 4CH MOVX @DPTR, A MOV DPTR, # 0101H; Command 5BH, set the synthetic display mode parameters MOV A, # 5BH MOVX @DPTR, A MOV DPTR, # 0000H MOV A, # 1CH; send display mode is three-screen graphics overlay mode ... MOV DPTR, # 0101H; the following is the screen clearing program MOV A, # 42H; show the slow write operation command MOVX @DPTR, A to SED1335 MOV R7, # 81H; the following program will clear all 32K display slow MOV DPTR, # 0000H LOOP: MOV R6, # 0FFH LOOP1: MOV A, # 00H MOVX @DPTR, A DJNZ R6, LOOP1 DJNZ R7, LOOP RET The above initialization program only lists some command codes and parameter settings. The main program is to send the picture data to SED1335 for LCD display. DAT EQU # 0000H; SED1335 controller data port address COM EQU # 0101H; SED1335 controller command port address SD1L EQU # 00H; the lower eight digits of the first slow start address displayed on the first screen SD1H EQU # 00H; the first screen starts The upper eight digits of the displayed slow first address ... PIC EQU # 1000H; picture data storage start address ORG 0000H AJMP START ORG 0080H START: MOV SP, # 60H LCALL INIT; initialize LCD MOV DPTR, COM MOV A, # 46H MOVX @DPTR, A MOV DPTR, DAT MOV A, SD1L MOVX @DPTR, A MOV DPTR, COM MOV A, # 42H; data write instruction to display buffer 42H MOVX @DPTR, A MOV DPTR, PIC MOV R7, # 240D; the number of outgoing loops 240 lines BMP: MOV R6, # 40D; 320 bytes per line requires 40 bytes of data BMP1: MOV A, # 3EH; bitmap data relative to the address of the bmp file header MOVC A , @ A + DPTR; check bitmap data INC DPTR PUSH DPL PUSH DPH MOV DPTR, DAT MOVX @DPTR, A; send the bitmap data to the POP DPH POP DPL DJNZ R6, BMP1; until all the one-screen bitmap data is sent to DJNZ R7, BMP ... After the program runs, the LCD should display the pattern shown in Figure 2. In the actual test, you can see a very clear image display. If you can't see or see the dark blue, adjust the contrast to see the pattern. Note that after power-on, the SED control board should be reset correctly, otherwise it will cause an error and cannot be displayed correctly. At this time, the LCD generally displays bright scanning lines. You can also write new parameters through the MPU to make the displayed image blink, flip, and move to meet different requirements. For the display front end of the general system, the processed data can also be displayed in real time by the same method. The above design process is relative to that used when displaying an image. This method will consume a lot of space. For a system with a small storage space in general, if only Chinese characters are to be displayed, the font to be displayed can be extracted and stored, and then recalled during display, which is also easy to implement and saves storage space. |