Fujitsu Microelectronics Europe MCU-AN-389018-E-V10 Application Note Connecting standard LCD modules to the MB89630 series Fujitsu Mikroelektronik GmbH 15.1.1997 Vers. 1.0 by M.Mierse In many applications, standard LCD modules are used. Such modules feature a dedicated controller on board to drive a dot matrix with a high segment count. Furthermore this controller provides a parallel interface to establish communication with other devices. In the majority of cases this is a HD44780A00 (or a compatible one). LCD standard display modules come in many sizes and shapes. Most of them are twisted nematic reflective displays which outputs one or more lines of alphanumerical characters. Each character is formed in a 5 by 8 matrix of dots. The intended applications are computer peripherals, word processors, facsimile machines, telecommunications systems, instruments, point-of-sale terminals, etc. How LCD's work As the name implies a liquid crystal is a compound that flows like a liquid but has a crystalline order in the arrangement of their molecules. In a display, these crystals keep their long axes aligned due to intermolecular forces. So by controlling the alignment, one effectively controls the optical properties as well as the ability of the crystals to affect the transmission of light. In a display, the liquid crystal material is sealed between two glass plates, one bearing transistors to control the electrode (row electrodes) of each cell, the other bearing colour filters and an electrode (column electrodes) to complete the circuit. Polarizers in the front and the rear complete the array which is illuminated from behind. Example application Fig. 1 shows how to connect a standard LCD module to the MB89637 EVAKIT. The device is connected to Port 3 of the EVAKIT in a 4-bit mode, so only 7 portpins are used (4 Data-lines and 3 Control-lines). The port output type has to be CMOS push-pull. Every data byte is transmitted in 2 nibbles using a handshake protocol. Four different display types were used to test the application. To activate the LCD-controller, an initial sequence has to be sent to the module. This procedure sets the device into the correct bus-mode and clears the internal RAM. Typical data transfer between the controller and the LCD then consists of commands (listed in table 2) and data (ASCII-compatible character set, see table 3). Example Code was written in ASM and C. MCU-AN-389018-E-V10 -1- © Fujitsu Microelectronics Europe GmbH 10k for contrast adjust VSS 1 VCC 2 GND (1) VCC (10) 3 RS (Data or Function) 4 RW (Read or Write) LCD 5 E (Enable) 6 11 12 13 14 P3.7 (9) MB89130 EVAKIT P3.6 (8) P3.4 (6) D0/D4 P3.0 (2) D1/D5 P3.1 (3) D2/D6 P3.2 (4) D3/D7 /Busy P3.3 (5) PORT 3 (JP 3-Pin) Fig. 1 : Connecting a standard LCD to the 8-bit-EVAKIT The pin assignment shown in Table 1 is the industry standard for character LCD-modules (except those with more than 80 characters). To be sure always check the manufacturers datasheet! The displays can be used in a 8-bit or a 4-bit-interface mode. Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Symbol Vss Vcc Vee RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 Level 0/1 0/1 1 0 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 I/O-Function I I I I/O I/O I/O I/O I/O I/O I/O I/O Function (8-bit mode) Power supply (GND) Power supply (+5V) Contrast adjust 0 = Instruction 1 = data 0 = Write to 1=Read from LCD Enable signal Data bus line 0 (LSB) Data bus line 1 Data bus line 2 Data bus line 3 Data bus line 4 Data bus line 5 Data bus line 6 Data bus line 7 (MSB) Function (4-bit mode) Power supply (GND) Power supply (+5V) Contrast adjust 0 = Instruction 1 = data 0 = Write to 1=Read from LCD Enable signal not used not used not used not used Data bus line 0 (LSB) and 4 Data bus line 1 and 5 Data bus line 2 and 6 Data bus line 3 and 7 (MSB) Table 1 : Pin assignment © Fujitsu Microelectronics Europe GmbH -2- MCU-AN-389018-E-V10 Instruction RS R W DB 7 DB 6 DB 5 DB 4 DB 3 DB 2 DB 1 DB 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 * 0 0 0 0 0 0 0 1 ID S 0 0 0 0 0 0 1 D C B 0 0 0 0 0 1 SL RL * * 0 0 0 0 1 DL N F * * 0 0 0 1 a a a a a a 0 0 1 a a a a a a a 0 1 BF a a a a a a a 1 0 d d d d d d d d 1 1 d d d d d d d d Clear display Cursor home Entry mode set Display On/Off control Cursor/ display shift Function set Set CGRAM address Set DDRAM address Read busy-flag Write to CG- or DD-RAM Read from CGor DD-RAM Description Clears display and returns cursor home Returns cursor to home position Sets cursor move direction (I/D), Sets On/Off of all display (D), cursor Sets cursor-move or display-shift Sets interface data length (DL), number Sets the CGRAM address. Sets the DDRAM address. Reads Busy-flag (BF) and address counter Writes data to CGRAM or DDRAM. Reads data from CGRAM or DDRAM. Execution time** 1.64ms 1.64ms 40µs 40µs 40µs 40µs 40µs 40µs 0µs 40µs 40µs Table 2 : HD44780 instruction set Remarks: DDRAM = Display Data RAM. CGRAM = Character Generator RAM. DDRAM address corresponds to cursor position.Address Counter used for both DDRAM and CGRAM. * = Don't care. ** = Based on Fosc = 250khz. a=address. d=data Table 3 : Character Set MCU-AN-389018-E-V10 -3- © Fujitsu Microelectronics Europe GmbH