• Inventory
  • Products
  • Technical Information
  • Circuit Diagram
  • Data Sheet
Technical Information
Home > Technical Information > MCU And DSP > Character LCD Module Controlled by Single-chip Computer

Character LCD Module Controlled by Single-chip Computer

Source:I4fun
Category:MCU And DSP
2023-04-04 16:32:32
96

  LCD monitors are widely used in pocket-size instruments and low-power application systems because of their small power consumption, small size, rich display content and ultra-thin and light weight. Character LCD module is a kind of LCD display that uses 5x7 dot matrix graphics to display characters. It can be divided into 16 words in one line, 16 words in two lines, 20 words in two lines and so on according to the display capacity. Here, the programming method of DM-162 LCD module with 16 words in two lines is introduced. DM-162 uses standard 14-foot interface, among which VSS is ground power supply, VDD is 5V positive power supply, V0 is the contrast adjustment end of LCD display, and the contrast is the weakest when connecting positive power. Contrast when grounded power supply, when the contrast is too high, "ghost" will occur, when used, the contrast can be adjusted by a 10K potentiometer. RS selects register, data register at high level and instruction register at low level. RW is read and write signal line, read at high level and write at low level. When RS and RW are both low level, commands or display addresses can be written, busy signals can be read when RS is low level RW and data can be written when RS is high level RW is low level. The E-end is the enabling end. When the E-end changes from high level to low level, the      LCD module executes commands. D0~D7 is an 8-bit bidirectional data line. The Character Generation Memory (CGROM) inside the DM-162 LCD module has stored 160 different bitmap character graphics, as shown in Table 1. These characters are: Arabic numerals, upper and lower case of English letters, commonly used symbols, Japanese kana, etc. Each character has a fixed code, such as the upper case of the English letter "A" code is 01000001 B (41H), When the module displays the dot matrix character graphics in the address 41H, we can see that there are 11 control instructions in the controller of the letter "A" DM-162 LCD module. As shown in Table 2, its read and write operation, screen and cursor operation are implemented by instruction programming. (Description: 1 is high level, 0 is low level) Directive

1: Clear display, instruction code 01H, cursor reset to address 00H position Directive

2: cursor reset, cursor return to address 00H Directive

3: Cursor and display mode settings I/D: Cursor movement direction, high level right shift, low level left shift S: whether all text on the screen moves left or right. High level means valid, low level means invalid Directive

4: Display switch control. D: Control the overall display on and off, high level indicates on and off, low level indicates on and off C: Control the cursor on and off, high level indicates the cursor, low level indicates no cursor B: Control whether the cursor flickers, high level flickers, low level does not flicker Directive

5: Cursor or display shift S/C: text displayed at high level, low level move cursor Directive

6: Function setting command DL: 4-bit bus at high level, Low level is 8-bit bus N: low level is one-line display, high level is two-line display F: low level shows 5x7 dot matrix characters, high level shows 5x10 dot matrix character instruction

7: character generator RAM address setting instruction

8:DDRAM address setting instruction

9: read busy signal and cursor address BF: for busy flag, high level indicates busy, at this time module cannot receive commands or data, if low level indicates not busy. Directive

10: Write data Directive

11: Read data DM-162 LCD module can directly interface with single-chip AT89C51, the circuit is shown in Figure 1. LCD module is a slow display device, so make sure that the busy flag of the module is low before executing each instruction, indicating that you are not busy, otherwise this instruction will not work. To display a character, first enter the display character address, which tells the module where to display the character. Table 3 is the internal display address of DM-162. For example, if the second character's address is 40H, can you write 40H directly to position the cursor at the second character? This is not possible, because writing display addresses requires bit D7 to be constant at high level 1, so the actual data written should be 01000000B (40H) +10000000B (80H) =11000000B (C0H). The following program displays the letter A at the second line of the LCD module: RS EQU P3.7 RW EQU P3.6 E EQU P3.5 ORG 0000H MOV P1, #00000001B; Clear screen ACALL ENABLE MOV P1, #00111000B; 8-bit 2-line 5x7 lattice ACALL ENABLE MOV P1, #00001111B; Display on, cursor on, flicker on ACALL ENABLE MOV P1, #00000110B; Text does not move, cursor automatically right ACALL ENABLE MOV P1, #0C0H; Write ACALL ENABLE MOV P1, 01000001B showing the starting address (second line location); The code SETB RS for letter A; RS=1 CLR RW; RW=0 CLR E; E=0 ACALL DELAY SETB E; E=1 AJMP$ENABLE: CLR RS; Subprogram CLR RW CLR E ACALL DELAY SETB E RET DELAY: MOV P1, #0FFH, which writes control commands; Subprogram CLR RS SETB RW CLR E NOP SETB E JB P1.7, DELAY to determine whether LCD is busy or not; If P1.7 is a high level indicating busy, wait for RET END in a loop;

 Source: xiangxueqin