The LCD Controller allows you to control the LCD screen on the DE2
board. It will recognize ASCII characters, and accepts various control
signals to modify the way it functions and the position of the cursor.
|Configuration||Two 8-bit mapped registers|
Note that because the instruction and data registers are only 8 bits each, the address offset for the data register is only 1, not 4 like most other devices.
|References||Altera's Documentation of LCD Core
Detailed Documentation of LCD Controller
(See page 14 for full list of instructions available)
DE2 Media Computer Manual (See section 4.4 for details.)
The LCD controller requires a control signal to change lines or
the position of the cursor other than advancing with each character,
rather than the ASCII codes.
|| bit 7
|| bits 6 to 0
|Set cursor location
|Shift display left
|Shift display right
|Cursor blink on
The address to which a character is written can be represented in the form (x,y) where x is the location on the line (0--15) and y is the row (0--1), in the following format:
Further details can be found in the DE2 Media Computer manual and the other reference material linked above.
Assembly Example: Writing the letter "A" to position 10 in the first line, then moving the cursor to the second line
movia r7, 0x10003050 /* r7 contains base address for LCD controller */
/* Set cursor to point 10 */
movi r3, 0x8a
movui r3, 65 /* ASCII code for A */
stbio r3, 1(r7) /* Write the letter A */
movui r3, 0xc0 /* Command for moving to the first bit of the second line */
stbio r3, 0(r7) /* Send the command */
C Example: Write "Hello World" to the LCD Display
void displayTextLCD(char * text_ptr)
volatile char * LCD_display_ptr = (char *) 0x10003050; // 16x2 character display
while ( *(text_ptr) )
*(LCD_display_ptr + 1) = *(text_ptr); // write to the LCD data register