Serial Communication with LC Controllers and Displays A 485 Project By: Paul J. Lansing Jason A. Ahrendt Jason D. Marsack Presented to: Rabinyara Mahapatara In Fulfillment of the Requirements for CPSC 485 Summer 1998 Serial to Parallel Communication I GOT THE BUS I GOT THE BUS I GOT THE BUS I GOT THE BUS Table of Contents 1. SERIAL BUFFER 1.1 RS232 and Serial Communications 1.2 Max232 Line Driver 1.3 6850 Asynchronous Communications Interface Adapter 1.4 Xilinx Control Module 1 2 3 4 5 2. TEXT LIQUID CRYSTAL DISPLAY AND CONTROLLER 6 3. LM211 Graphical LCD DISPLAY AND CONTROLLER 3.1 Introduction to the LM211 3.2 Physical Construction 3.3 Voltage Source Requirements 3.4 Control Signal Requirements 3.5 LM211DVR Xilinx Control Module 3.6 Protocol for the LM211DVR 3.7 Sub-Modules of the LM211DVR 7 4. Aggregation of Separate Components 14 5. Appendix A: Figures for Serial Buffer Figure 1.1 Serial Buffer Test fixture Figure 1.2 Serial Buffer Sub-Module Figure 1.3 Control Module State Diagram Figure 1.4 Control Module ABEL Code 15 16 17 18 19 6. Appendix B: Figures for Text LCD Display and Controller Figure 2.1 Figure 2.2 Figure 2.3 Figure 2.4 Figure 2.5 Figure 2.6 Figure 2.7 Figure 2.8 20 21 22 23 24 24 25 26 27 7. Appendix C: Figures for Graphical LCD Display and Controller Figure 3.1 Figure 3.2 Figure 3.3 Figure 3.4 Figure 3.5 Figure 3.6 Figure 3.7 Figure 3.8 28 29 30 31 32 33 34 35 36 8. Appendix D: Hitachi LM211 Data Sheet 37 8 9 10 11 12 13 14 9. Appendix E: Shift Register Data Sheets 38 3.1 Introduction to the LM211 LCD Display The LM211 is a Hitachi product. It was first used in the early eighties in medical devices and has since then been phased out of use almost completely (Only a few CS students at Texas A&M University still use this panel). This may discourage a user at first, but the fact that the panel is older is a plus. The simplicity of the older display makes it an excellent example for learning to use even the most modern graphical LCD displays. The LM211 operates in the same way as current laptop monitors work. Another good feature of the LM211 is that although it does not come with hardware to decipher codes like a text display, the hardware needed to drive the device is minimal. This is because the LM211 has a simple design. Understanding how the LM211 works is not difficult. It actually is quite logical and methodical. 3.2 Construction of the LM211 Graphical LCD Display The LM211 has a very simple design. This design along with all hardware components is listed below. It would be helpful to obtain a LM211 panel to use while reading this section. pin connections pin connections 240 pixels 64 pixels 240 pixels Display Area Figure 3.1: Front View of the LM211 Graphical LCD Panel A6 A4 A2 A12 A10 A8 A6 A3 A1 A11 A9 A7 B1 B2 B: MSM5239 Shift Register A: MSM5238 Shift Register Figure 3.2: Rear View of the LM211 Graphical LCD Panel Figure 3.3 Side View of the LM211 Graphical LCD Display MSM5238 32 Dot Common Driver: The devices labeled B1 and B2 above belong to this family of shift registers. The MSM5238 is a 32 bit shift register. Two of the devices are put in series to represent the 64 rows of the panel. MSM5839 40-Dot Segment Driver: The devices in Diagram 2 labeled A1-A12 belong to this family of shift registers. These 12 registers control the horizontal movement of data. This spans 480 pixels. 3.3 Voltage Source Requirements for the LM211 Panel The LM211 has 4 voltage inputs. They are listed with their function in the table below. Pin 7 8 9 10 Voltage Level 4.75-5 V 0V -8.5—9 V Symbol Vdd Vss Vee Vo Function Power Supply Ground Power Supply for LC driving Operating Voltage for LC Driving Table 3.1 Voltage Supplies for the LM211 Vdd is the voltage source that powers all the circuitry on the back of the panel. This includes the shift registers and capacitors. Vss is the ground for the board. Vee is the voltage used to power the LC driving circuitry. This circuitry is separate from the shift registers on the back of the panel. Vo is the voltage that causes the liquid crystal to change from dark to light. This is the Liquid Crystal driving voltage. All of the above voltages are required for proper operation of the LCD panel. 3.4 Input Signals for the LM211 Panel There are 4 input signals for the LM211. They are listed below with a description of their function. Pin 1 2 Name D1 FLM 3 4 5 6 M CL1 CL2 D2 Function Data line for left half of the screen Indicates the beginning of a new Display Cycle Control Signal for AC Driving Latches serial data into the shift Registers Clock signal for shifting the serial data Data input for right half of the screen Table 3.2: Input Signals for the LM211 D1 and D2 are the input lines for data. Bits are taken serially, so to fill an entire half of the screen, the panel needs to be given 15360 different bit values. CL2 is the master clock for the entire circuit. Each clock of CL2 represents a bit being shifted from D1 and D2 into the horizontal shift registers. Since there are 240 pixels on each half of the screen, this clock iterates 240 times filling all the pins of the shift registers. CL1 latches the data into place. Once the user has specified the 240 bits, they are shifted into an active mode where they are displayed on the screen. FLM determines which vertical line on the screen is active. FLM is high one time every 64 CL1 pulses. This high value is then passed down through the shift register. In this way, every line will be high one time through the entire screen refresh. M is a signal used to keep the liquid crystal from breaking down. If direct current is constantly applied to the panel, the crystal will be damaged and will no longer be able to change from dark to light. By alternating the direction the current flows through the panel, the panel is protected from thermal breakdown. 3.5 The LM211DVR Xilinx Module The LM211 is nothing more than a display panel. It does not have an on panel controller chip. Thus, the signals specified above must be implemented externally and applied to the panel. This is achieved in one form in the LM211DVR circuit. This circuit created Cl1,Cl2,M,and FLM. In addition to these signals, the module allows for a 1 byte input that specifies data to be displayed on the screen. This data is manipulated by functions within the module to produce different patterns on the screen. The module has an onboard ram. The user can write to this ram and store information in the controller chip. All these details will be explained in detail below. The first important step to understanding the LM211DVR is to master the protocol. The onboard memory in the LM211DVR circuit provides the user with 64 bit memory, 8 bits square. This is known as a glyph. Only 1 glyph can be displayed at a time. The glyph originally appears at the 0 location on the screen. The LM211 is capable of writing a bit in the glyph, shifting the glyph, zooming or shrinking the glyph, inverting all bits on the screen, and of tiling the screen. The above diagram is of the LM211DVR module. There are 9 input signals and 6 output signals. When the user wants to write to the panel, a byte of data corresponding to the desired function is chosen from the protocol and placed on lines in0-in7. Note that in0 is the least significant bit. Once the data is correctly placed on the input lines, the handshake signal is pulsed. This lets the data enter the LM211DVR circuit. This information is stored in flip flops and the specified operation is carried out. The 5 outputs are the control signals specified earlier, CL2, CL1, FLM, M and the data lines D1 and D2. The control signals continually output to the screen causing the screen to be updated according to what is stored in the internal ram. The data lines output this information and put it on the screen according to what functions the user has chosen. 3.6 Sub-Modules of the LM211DVR Circuit: There are 9 Sub-Modules on the LM211DVR circuit. They are listed in the table below with their function. CONTROLREG ZOOMREG SHIFTREG VSHFTR SHIFTER ZOOM TILE GRAPDISP SIGNALS Holds the data related to the on/off, tile, and invert bits. Holds the amount of zoom desired. Holds the amount of shift required. Shifts the vertical bits. Shifts the horizontal bits. Zooms the glyph according to how much zoom is requested in ZOOMREG Repeats the glyph every 8 pixels. Contains the SIGNALS module and the power supplies for that module Creates the signals CL1, CL2, FLM, M and DI, D2 Table 3.3: Modules in LM211DVR As can be seen in Diagram 6, the LM211 module is broken into sub-modules. Each module has a specific task. This section describes the modules in the order they are encountered by actual data. CONTROLREG is the first module to study. The protocol used to activate this register is as follows. 00001OTIX. The first 5 bits are a pattern that activate the control register. The O determines whether the screen is on or off ( 1 for on 0 for off), the T determines if the screen is tiled or not (1 for not tiled and 0 for tiled) and the I determines whether the screen is inverted or not ( 0 for not inverted and 1 for inverted). For instance, a 00001110 would tell the circuit to turn onn, invert the bits and tile the screen. Since the first 5 bit pattern is unique to this module, the zoom, shift and write capabilities will not be affected. ZOOMREG is the next module to study. The protocol for zoom is 000000DML. The D stands for which direction the zoom is desired( 0 for vertical and 1 for horizontal). The M and L refer to the most and least significant bits of the zoom. Four different zoom settings are possible. These settings are 1x, 2x, 4x and 8x. These zooms go from 1x at ML = 00 to 8x at ML = 11. Note that this module does not actually do the logic to implement the zoom, it only stores the user request for zoom. A later module, ZOOM actually calculates the zoom. ZOOM actually implements the zoom command. It uses a hardware zoom. By shifting what lines are being input as the least significant bit, the size of the glyph will be changed. SHIFTREG is similar to ZOOMREG in that it does not actually zoom, it only holds the users request for a shift. The modules VSHIFTR and SHIFTER actually do the shifting logic. SHIFTREG has a protocol that is more complicated than ZOOMREG. Since up to 8 bits can be specified in a shift, we need to use 2 bytes. Because of this, the vertical shift and horizontal shift are broken into upper and lower halves. The vertical shift protocol for the upper half is 0101DDDD and the lower is 0011DDDD where D can be set to 1 or 0. The protocol for a horizontal shift is 0001DDDD and 0100DDDD where D can be set to 1 or 0. These values are stored in d flip-flops so they will be implemented when the input changes. VSHIFTR and SHIFTER are the modules that shift the data on the screen. The amount of shift is received from the SHIFTREG flip-flops. TILE is a large and gate that determines whether the user wants the glyph in memory repeated across the screen. If tiling is wanted, the same glyph will be covering the screen. GRAPDISP and SIGNALS can be grouped together. They output the signals that control data flow to the panel. These signals are namely CL1, CL2, FLM and M. These signals are generated using ABEL HDL. This is because of the complex relationship between the signals. Implementing the same signals using only schematics would have been quite difficult and confusing. By using ABEL, a single counter can be used and different areas of the counter can be correlated to certain signals. 3.7 Protocol for the LM211DVR Circuit The following protocol is for the input lines of the LM211DVR circuit. Data Input msb lsb 00001OTI Operation 0101DDDD Set Control Register Flip Flops according to O,T and I O ( 0 screen off, 1 screen on) T ( 0 tile on, 1 tile off) I ( 0 invert off, 1 invert on) Set Vertical Zoom Register Flip Flops according to DD DD 00 no zoom 01 2x zoom 10 4x zoom 11 8x zoom Set Horizontal Zoom Register Flip Flops according to DD DD 00 no zoom 01 2x zoom 10 4x zoom 11 8x zoom Set pixel at Address AAAAAA D = 0 pixel off D = 1 pixel on Set Vertical High Shift Bits according to DDDD 0011DDDD Set Vertical Low Shift Bits according to DDDD 0100DDDD Set Horizontal High Shift Bits according to DDDD 0001DDDD Set Horizontal Low Shift Bits according to DDDD 000000DD 000001DD 1DAAAAAA Table 3.4: Protocol for LM211DVR 4. Aggregating Separate Components The serial buffer and separate LCD controllers are to be integrated into one complete module capable of receiving serial data and displaying text and graphical information on the LCD displays. The serial buffer is a global device that can generate data for different types of controllers. In this project, the serial buffer is able to communicate with both a graphical and a text LCD controller. Each controller has an eight-bit input and a strobe signal. The serial buffer places data on the eight data lines and sends a strobe signal indicating that the data is valid. The controllers then take the data and use it per their design. The serial buffer does not know what the data being sent is to be used for. It does not care. Its job is to send the data to the controllers. Appendix A: Figures for Serial Buffer Appendix B: Figures for text LCD Display and Controller Appendix C: Figures for Graphical LCD Display and Controller Appendix D: Hitachi LM211 Data Sheet APPENDIX E: Shift Register Data Sheets