1300 Henley Court Pullman, WA 99163 509.334.6306 www.digilentinc.com PmodCLPTM Reference Manual Revised May 24, 2016 This manual applies to the PmodCLP rev. B Overview The Digilent PmodCLP is a 16x2 character LCD module that uses a 8-bit parallel data interface to let system boards display up to 32 different characters out of over 200 possible options. Features include: The PmodCLP. 1 16x2 character LCD with parallel interface 192 predefined characters including 93 ASCII characters Up to 8 user-definable characters Read and write capability to and from the display Small PCB size for flexible designs 2.3" x 3.3" (5.8 cm x 8.4 cm) Follows Digilent Pmod Interface Specification Type 1 Library and example code available in resource center Functional Description The PmodCLP utilizes a Samsung KS0066 LCD controller to display information to a Sunlike LCD panel. The module can execute a variety of instructions, such as erasing specific characters, setting different display modes, scrolling, and displaying user-defined characters. 2 Interfacing with the Pmod The PmodCLP communicates with the host board via the GPIO protocol. This particular module requires specific timings in order to program the KS0066 correctly, as per the KS0066 datasheet. These timings are described after the pinout description table shown below: DOC#: 502-142 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 1 of 6 PmodCLPTM Reference Manual Header J1 - Top Half Pin Signal Description Header J1 - Bottom Half Pin Signal Description Pin Signal 1 DB0 Data Bit 0 7 DB4 Data Bit 4 1 RS 2 DB1 Data Bit 1 8 DB5 Data Bit 5 2 R/W 3 DB2 Data Bit 2 9 DB6 Data Bit 6 3 E 4 DB3 Data Bit 3 10 DB7 Data Bit 7 4 NC 5 GND 11 GND Power Supply Ground 5 GND Power Supply Ground 6 VCC 12 VCC Positive Power Supply 6 VCC Positive Power Supply Power Supply Ground Positive Power Supply1 Header J2 Description Register Select: High for Data Transfer, Low for Instruction Transfer Read/Write signal: High for Read mode, Low for Write mode Read/Write Enable: High for Read, falling edge writes data Optional back-light enable (not connected on the PmodCLP Table 1. PmodCLP Connector Signals. 2.1 Timing Requirements After power-on, at least 20ms must elapse before the "Function Set" instruction code can be written to set the bus width, number of lines, and character patterns (8-bit interface, 2 lines, and 5x8 dots are appropriate). After the Function Set instruction, at least 37us must elapse before the "Display On/Off Control" instruction can be written (to turn the display on, turn the cursor on or off, and set the cursor to blink or no blink). After another 37us, the "Clear Display" instruction can be issued. After another 1.52ms, the "Entry Mode Set" instruction can set address increment (or address decrement) mode, and display shift mode (on or off). After this sequence, data can be written into the DDRAM via the "Write data into RAM" to cause information to appear on the display. Note that other compatible LCD controllers use similar start-up sequences which may not use the same timings as the Samsung controller. Power On Wait 20ms Set Function Wait 37 us Display Set Wait 37 us Display Clear Wait 1.52ms The table below lists the required bit order needed in order to send a variety of instructions to the LCD controller on the PmodCLP. Before the 8 bits of parallel data (DB7 through DB0) are OK sent, the output enable pin, E, must be brought to a high '1' state and then brought to a low Figure 1. LCD startup sequence. '0' state at end of the sequence in order to transfer the data bits to the LCD controller. 1 For Revision A of the PmodCLP this must be at 5V. For Revision B, this must be at 3.3V Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 2 of 6 PmodCLPTM Reference Manual 2.2 PmodCLP Instruction Codes Instruction RS R/W DB7 Instruction bit assignments DB6 DB5 DB4 DB3 DB2 DB1 DB0 Clear Display 0 0 0 0 0 0 0 0 0 1 Return Home 0 0 0 0 0 0 0 0 1 X Entry Mode Set 0 0 0 0 0 0 0 1 I/D SH Display On/Off Control 0 0 0 0 0 0 1 D C B Cursor or Display shift 0 0 0 0 0 1 S/C R/L X X Function Set 0 0 0 0 1 DL N F X X 0 0 0 1 AC5 AC4 AC3 AC2 AC1 AC0 0 0 1 AC6 AC5 AC4 AC3 AC2 AC1 AC0 Read busy flag/address 0 1 BF AC6 AC5 AC4 AC3 AC2 AC1 AC0 Write data toRAM 1 0 D7 D6 D5 D4 D3 D2 D1 D0 Read data toRAM 1 1 D7 D6 D5 D4 D3 D2 D1 D0 Set CGRAM Address Set DDRAM Address Description Clear display by writing a 20H to all DDRAM locations; set DDRAM address register to 00H; and return cursor to home. Return cursor to home (upper left corner), and set DDRAM address to 0H. DDRAM contents not changed. I/D = '1' for right-moving cursor and address increment; SH = '1' for display shift (direction set by I/D bit). Set display (D), cursor (C), and blinking cursor (B) on or off. S/C = '0' to shift cursor right or left, '1' to shift entire display right or left (R/L = '1' for right). Set interface data length DL ('1' for 8 bit), number of display lines N ('1' for 2 lines), font F ('0' for 5x8 dots) Set CGRAM address counter AC5 - AC0 Set CGRAM address counter AC5 - AC0 Read busy flag (BF) and address counter AC6AC0 Write data into DDRAM or CGRAM, depending on which address was last set Read data into DDRAM or CGRAM, depending on which address was last set Table 2. LCD Instructions and codes. Note: "X" represents a don't care bit. Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 3 of 6 PmodCLPTM Reference Manual 2.3 CGRAM and DDRAM The LCD controller contains a character-generator ROM (CGROM) with 192 preset 5x8 character patterns (see table 4 below), a character-generator RAM (CGRAM) that can hold 8 user-defined 5x8 characters, and a display data RAM (DDRAM) that can hold 80 character codes. Character codes written into the DDRAM serve as indexes into the CGROM (or CGRAM). Writing a character code into a particular DDRAM location will cause the associated character to appear at the corresponding display location. Display positions can be shifted left or right by setting a bit in the Instruction Register (IR). The write-only IR directs display operations (such as clear display, shift left or right, set DDRAM address, etc). A busy flag shows whether the display has competed the last requested operation; prior to initiating a new operation, the flag can be checked to see if the previous operation has been completed. The display has more DDRAM locations than can be displayed at any given time. DDRAM locations 00H to 27H map to the first display row, and locations 40H to 67H map to the second row. Normally, DDRAM location 00H maps to the upper left display corner (the "home" location, and 40H to the lower left. Shifting the display left or right can change this mapping. The display uses a temporary data register (DR) to hold data during DDRAM /CGRAM reads or writes, and an internal address register to select the RAM location. Address register contents, set via the Instruction Register, are automatically incremented after each read or write operation. The LCD display uses ASCII character codes. Codes up through 7F are standard ASCII (which includes all "normal" alphanumeric characters). Codes above 7F produce various international characters. The predefined characters available to display (from the KS0066 datasheet) are shown in the table below: Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 4 of 6 PmodCLPTM Reference Manual 2.4 Predefined Character Table Any external power applied to the PmodCLP must be at 5V for Revision A of the PmodCLP and at 3.3V for Revision B of the PmodCLP. Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 5 of 6 PmodCLPTM Reference Manual 3 Physical Descriptions The pins on the pin header are spaced 100 mil apart. The PCB is 2.3 inches long on the sides parallel to the pins on the pin header and 3.3 inches long on the sides perpendicular to the pin header. Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 6 of 6