48 www.xilinx.comSpartan-3A/3AN FPGA Starter Kit Board User GuideUG334 (v1.1) June 19, 2008Chapter 5: Character LCD Screen RThe CG RAM address counter either remains constant after read or write operations, orauto-increments or auto-decrements by one location, as defined by the I/D set by the EntryMode Set command.Figure 5-5 provides an example that creates a special checkerboard character. The customcharacter is stored in the fourth CG RAM character location, which is displayed when aDD RAM location is 0x03. To write the custom character, the CG RAM address is firstinitialized using the Set CG RAM Address command. The upper three address bits point tothe custom character location. The lower three address bits point to the row address for thecharacter bitmap. The Write Data to CG RAM or DD RAM command is used to write eachcharacter bitmap row. A ‘1’ lights a bit on the display. A ‘0’ leaves the bit unlit. Only thelower five data bits are used; the upper three data bits are don’t care positions. The eighthrow of bitmap data is usually left as all zeros to accommodate the cursor.Command SetTable 5-2 summarizes the available LCD controller commands and bit definitions. Becausethe display is set up for four-bit operation, each eight-bit command is sent as two four-bitnibbles. The upper nibble is transferred first, followed by the lower nibble.Upper Nibble Lower NibbleWrite Data to CG RAM or DD RAMA5 A4 A3 A2 A1 A0 D7 D6 D5 D4 D3 D2 D1 D0Character Address Row Address Don’t Care Character Bitmap0 1 1 0 0 0 - - - 0 1 0 1 00 1 1 0 0 1 - - - 1 0 1 0 10 1 1 0 1 0 - - - 0 1 0 1 00 1 1 0 1 1 - - - 1 0 1 0 10 1 1 1 0 0 - - - 0 1 0 1 00 1 1 1 0 1 - - - 1 0 1 0 10 1 1 1 1 0 - - - 0 1 0 1 00 1 1 1 1 1 - - - 0 0 0 0 0Figure 5-5: Example Custom Checkerboard Character with Character Code 0x03Table 5-2: LCD Character Display Command Set (4-bit mode)FunctionLCD_RSLCD_RW Upper Nibble Lower NibbleDB7DB6DB5DB4DB3DB2DB1DB0Clear Display 0 0 0 0 0 0 0 0 0 1Return Cursor Home 0 0 0 0 0 0 0 0 1 -Entry Mode Set 0 0 0 0 0 0 0 1 I/D SDisplay On/Off 0 0 0 0 0 0 1 D C BCursor and Display Shift 0 0 0 0 0 1 S/C R/L - -