3 * Simple "driver" for a memory-mapped 44780-style LCD display.
5 * Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
14 #define LCD44780_COMMAND ((volatile unsigned char *)0xbe020000)
15 #define LCD44780_DATA ((volatile unsigned char *)0xbe020001)
17 #define LCD44780_4BIT_1LINE 0x20
18 #define LCD44780_4BIT_2LINE 0x28
19 #define LCD44780_8BIT_1LINE 0x30
20 #define LCD44780_8BIT_2LINE 0x38
21 #define LCD44780_MODE_DEC 0x04
22 #define LCD44780_MODE_DEC_SHIFT 0x05
23 #define LCD44780_MODE_INC 0x06
24 #define LCD44780_MODE_INC_SHIFT 0x07
25 #define LCD44780_SCROLL_LEFT 0x18
26 #define LCD44780_SCROLL_RIGHT 0x1e
27 #define LCD44780_CURSOR_UNDERLINE 0x0e
28 #define LCD44780_CURSOR_BLOCK 0x0f
29 #define LCD44780_CURSOR_OFF 0x0c
30 #define LCD44780_CLEAR 0x01
31 #define LCD44780_BLANK 0x08
32 #define LCD44780_RESTORE 0x0c // Same as CURSOR_OFF
33 #define LCD44780_HOME 0x02
34 #define LCD44780_LEFT 0x10
35 #define LCD44780_RIGHT 0x14
37 void lcd44780_wait(void)
40 for(i=0; i < 400; i++)
41 for(j=0; j < 10000; j++);
44 void lcd44780_command(unsigned char c)
46 *LCD44780_COMMAND = c;
50 void lcd44780_data(unsigned char c)
56 void lcd44780_puts(const char* s)
61 lcd44780_command(LCD44780_CLEAR);
67 /* We must write 32 of spaces to get cursor to 2nd line */
68 for (j=0; j<32; j++) {
73 /* We have filled all 16 character positions, so stop
78 #ifdef LCD44780_PUTS_PAUSE
82 for(i = 1; i < 2000; i++)
88 void lcd44780_init(void)
90 // The display on the RockHopper is physically a single
91 // 16 char line (two 8 char lines concatenated). bdl
92 lcd44780_command(LCD44780_8BIT_2LINE);
93 lcd44780_command(LCD44780_MODE_INC);
94 lcd44780_command(LCD44780_CURSOR_BLOCK);
95 lcd44780_command(LCD44780_CLEAR);