Rev Author Line No. Line
1212 kakl 1 /*! \file lcdconf.h \brief Character LCD driver configuration. */
2 //*****************************************************************************
3 //
4 // File Name : 'lcdconf.h'
5 // Title : Character LCD driver for HD44780/SED1278 displays
6 // (usable in mem-mapped, or I/O mode)
7 // Author : Pascal Stang - Copyright (C) 2000-2002
8 // Created : 11/22/2000
9 // Revised : 4/30/2002
10 // Version : 1.1
11 // Target MCU : Atmel AVR series
12 // Editor Tabs : 4
13 //
14 // This code is distributed under the GNU Public License
15 // which can be found at http://www.gnu.org/licenses/gpl.txt
16 //
17 //*****************************************************************************
18  
19 #ifndef LCDCONF_H
20 #define LCDCONF_H
21  
22 // Define type of interface used to access the LCD
23 // LCD_MEMORY_INTERFACE:
24 // To use this mode you must supply the necessary hardware to connect the
25 // LCD to the CPU's memory bus. The CONTROL and DATA registers of the LCD
26 // (HD44780 chip) must appear in the CPU's memory map. This mode is faster
27 // than the port interface but requires a little extra hardware to make it
28 // work. It is especially useful when your CPU is already configured to
29 // use an external memory bus for other purposes (like accessing memory).
30 //
31 // LCD_PORT_INTERFACE:
32 // This mode allows you to connect the control and data lines of the LCD
33 // directly to the I/O port pins (no interfacing hardware is needed),
34 // but it generally runs slower than the LCD_MEMORY_INTERFACE.
35 // Depending on your needs, when using the LCD_PORT_INTERFACE, the LCD may
36 // be accessed in 8-bit or 4-bit mode. In 8-bit mode, one whole I/O port
37 // (pins 0-7) is required for the LCD data lines, but transfers are faster.
38 // In 4-bit mode, only I/O port pins 4-7 are needed for data lines, but LCD
39 // access is slower. In either mode, three additional port pins are
40 // required for the LCD interface control lines (RS, R/W, and E).
41  
42 // Enable one of the following interfaces to your LCD
43 //#define LCD_MEMORY_INTERFACE
44 #define LCD_PORT_INTERFACE
45  
46 // Enter the parameters for your chosen interface'
47 // if you chose the LCD_PORT_INTERFACE:
48 #ifdef LCD_PORT_INTERFACE
49 #ifndef LCD_CTRL_PORT
50 // port and pins you will use for control lines
51 #define LCD_CTRL_PORT PORTC
52 #define LCD_CTRL_DDR DDRC
53 #define LCD_CTRL_RS 2
54 #define LCD_CTRL_RW 3
55 #define LCD_CTRL_E 4
56 #endif
57 #ifndef LCD_DATA_POUT
58 // port you will use for data lines
59 #define LCD_DATA_POUT PORTA
60 #define LCD_DATA_PIN PINA
61 #define LCD_DATA_DDR DDRA
62 // access mode you will use (default is 8bit unless 4bit is selected)
63 #define LCD_DATA_4BIT
64 #endif
65 #endif
66  
67 // if you chose the LCD_MEMORY_INTERFACE:
68 #ifdef LCD_MEMORY_INTERFACE
69 #ifndef LCD_CTRL_ADDR
70 // CPU memory address of the LCD control register
71 #define LCD_CTRL_ADDR 0x1000
72 #endif
73 #ifndef LCD_DATA_ADDR
74 // CPU memory address of the LCD data register
75 #define LCD_DATA_ADDR 0x1001
76 #endif
77 #endif
78  
79  
80 // LCD display geometry
81 // change these definitions to adapt settings
82 #define LCD_LINES 2 // visible lines
83 #define LCD_LINE_LENGTH 16 // line length (in characters)
84 // cursor position to DDRAM mapping
85 #define LCD_LINE0_DDRAMADDR 0x00
86 #define LCD_LINE1_DDRAMADDR 0x40
87 #define LCD_LINE2_DDRAMADDR 0x14
88 #define LCD_LINE3_DDRAMADDR 0x54
89  
90 // LCD delay
91 // This delay affects how quickly accesses are made to the LCD controller.
92 // The HD44780 LCD controller requires an access time of at least 1us.
93 // LCD_DELAY should be scaled to take at least half that time (500us).
94 // Each NOP takes 1 CPU clock cycle to execute. Thus, at 4MHz, you should
95 // use at least 2 NOPs, at 8MHz at least 4 NOPs, etc.
96 // You can also use the delay_us(xx) command for longer access times.
97  
98 // LCD_DELAY is now automatically set in lcd.h,
99 // however, if you define it here, this definition will override the automatic setting
100  
101 // use this for a fail-safe delay
102 //#define LCD_DELAY delay_us(5);
103  
104 #endif