Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
||
3 | <title>Procyon AVRlib: conf/lcdconf.h Source File</title> |
||
4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
5 | </head><body> |
||
6 | <!-- Generated by Doxygen 1.4.2 --> |
||
7 | <div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
||
8 | <div class="nav"> |
||
9 | <a class="el" href="dir_000000.html">conf</a></div> |
||
10 | <h1>lcdconf.h</h1><a href="lcdconf_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file lcdconf.h \brief Character LCD driver configuration. */</span> |
||
11 | 00002 <span class="comment">//*****************************************************************************</span> |
||
12 | 00003 <span class="comment">//</span> |
||
13 | 00004 <span class="comment">// File Name : 'lcdconf.h'</span> |
||
14 | 00005 <span class="comment">// Title : Character LCD driver for HD44780/SED1278 displays</span> |
||
15 | 00006 <span class="comment">// (usable in mem-mapped, or I/O mode)</span> |
||
16 | 00007 <span class="comment">// Author : Pascal Stang - Copyright (C) 2000-2002</span> |
||
17 | 00008 <span class="comment">// Created : 11/22/2000</span> |
||
18 | 00009 <span class="comment">// Revised : 4/30/2002</span> |
||
19 | 00010 <span class="comment">// Version : 1.1</span> |
||
20 | 00011 <span class="comment">// Target MCU : Atmel AVR series</span> |
||
21 | 00012 <span class="comment">// Editor Tabs : 4</span> |
||
22 | 00013 <span class="comment">//</span> |
||
23 | 00014 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
24 | 00015 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
25 | 00016 <span class="comment">//</span> |
||
26 | 00017 <span class="comment">//*****************************************************************************</span> |
||
27 | 00018 |
||
28 | 00019 <span class="preprocessor">#ifndef LCDCONF_H</span> |
||
29 | 00020 <span class="preprocessor"></span><span class="preprocessor">#define LCDCONF_H</span> |
||
30 | 00021 <span class="preprocessor"></span> |
||
31 | 00022 <span class="comment">// Define type of interface used to access the LCD</span> |
||
32 | 00023 <span class="comment">// LCD_MEMORY_INTERFACE:</span> |
||
33 | 00024 <span class="comment">// To use this mode you must supply the necessary hardware to connect the</span> |
||
34 | 00025 <span class="comment">// LCD to the CPU's memory bus. The CONTROL and DATA registers of the LCD</span> |
||
35 | 00026 <span class="comment">// (HD44780 chip) must appear in the CPU's memory map. This mode is faster</span> |
||
36 | 00027 <span class="comment">// than the port interface but requires a little extra hardware to make it</span> |
||
37 | 00028 <span class="comment">// work. It is especially useful when your CPU is already configured to</span> |
||
38 | 00029 <span class="comment">// use an external memory bus for other purposes (like accessing memory).</span> |
||
39 | 00030 <span class="comment">//</span> |
||
40 | 00031 <span class="comment">// LCD_PORT_INTERFACE:</span> |
||
41 | 00032 <span class="comment">// This mode allows you to connect the control and data lines of the LCD</span> |
||
42 | 00033 <span class="comment">// directly to the I/O port pins (no interfacing hardware is needed),</span> |
||
43 | 00034 <span class="comment">// but it generally runs slower than the LCD_MEMORY_INTERFACE.</span> |
||
44 | 00035 <span class="comment">// Depending on your needs, when using the LCD_PORT_INTERFACE, the LCD may</span> |
||
45 | 00036 <span class="comment">// be accessed in 8-bit or 4-bit mode. In 8-bit mode, one whole I/O port</span> |
||
46 | 00037 <span class="comment">// (pins 0-7) is required for the LCD data lines, but transfers are faster.</span> |
||
47 | 00038 <span class="comment">// In 4-bit mode, only I/O port pins 4-7 are needed for data lines, but LCD</span> |
||
48 | 00039 <span class="comment">// access is slower. In either mode, three additional port pins are</span> |
||
49 | 00040 <span class="comment">// required for the LCD interface control lines (RS, R/W, and E).</span> |
||
50 | 00041 |
||
51 | 00042 <span class="comment">// Enable one of the following interfaces to your LCD</span> |
||
52 | 00043 <span class="comment">//#define LCD_MEMORY_INTERFACE</span> |
||
53 | 00044 <span class="preprocessor">#define LCD_PORT_INTERFACE</span> |
||
54 | 00045 <span class="preprocessor"></span> |
||
55 | 00046 <span class="comment">// Enter the parameters for your chosen interface'</span> |
||
56 | 00047 <span class="comment">// if you chose the LCD_PORT_INTERFACE:</span> |
||
57 | 00048 <span class="preprocessor">#ifdef LCD_PORT_INTERFACE</span> |
||
58 | 00049 <span class="preprocessor"></span><span class="preprocessor"> #ifndef LCD_CTRL_PORT</span> |
||
59 | 00050 <span class="preprocessor"></span> <span class="comment">// port and pins you will use for control lines</span> |
||
60 | 00051 <span class="preprocessor"> #define LCD_CTRL_PORT PORTC</span> |
||
61 | 00052 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_CTRL_DDR DDRC</span> |
||
62 | 00053 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_CTRL_RS 2</span> |
||
63 | 00054 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_CTRL_RW 3</span> |
||
64 | 00055 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_CTRL_E 4</span> |
||
65 | 00056 <span class="preprocessor"></span><span class="preprocessor"> #endif</span> |
||
66 | 00057 <span class="preprocessor"></span><span class="preprocessor"> #ifndef LCD_DATA_POUT</span> |
||
67 | 00058 <span class="preprocessor"></span> <span class="comment">// port you will use for data lines</span> |
||
68 | 00059 <span class="preprocessor"> #define LCD_DATA_POUT PORTA</span> |
||
69 | 00060 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_DATA_PIN PINA</span> |
||
70 | 00061 <span class="preprocessor"></span><span class="preprocessor"> #define LCD_DATA_DDR DDRA</span> |
||
71 | 00062 <span class="preprocessor"></span> <span class="comment">// access mode you will use (default is 8bit unless 4bit is selected)</span> |
||
72 | 00063 <span class="comment">//#define LCD_DATA_4BIT</span> |
||
73 | 00064 <span class="preprocessor"> #endif</span> |
||
74 | 00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
||
75 | 00066 <span class="preprocessor"></span> |
||
76 | 00067 <span class="comment">// if you chose the LCD_MEMORY_INTERFACE:</span> |
||
77 | 00068 <span class="preprocessor">#ifdef LCD_MEMORY_INTERFACE</span> |
||
78 | 00069 <span class="preprocessor"></span><span class="preprocessor"> #ifndef LCD_CTRL_ADDR</span> |
||
79 | 00070 <span class="preprocessor"></span> <span class="comment">// CPU memory address of the LCD control register</span> |
||
80 | 00071 <span class="preprocessor"> #define LCD_CTRL_ADDR 0x1000</span> |
||
81 | 00072 <span class="preprocessor"></span><span class="preprocessor"> #endif</span> |
||
82 | 00073 <span class="preprocessor"></span><span class="preprocessor"> #ifndef LCD_DATA_ADDR</span> |
||
83 | 00074 <span class="preprocessor"></span> <span class="comment">// CPU memory address of the LCD data register</span> |
||
84 | 00075 <span class="preprocessor"> #define LCD_DATA_ADDR 0x1001</span> |
||
85 | 00076 <span class="preprocessor"></span><span class="preprocessor"> #endif</span> |
||
86 | 00077 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
||
87 | 00078 <span class="preprocessor"></span> |
||
88 | 00079 |
||
89 | 00080 <span class="comment">// LCD display geometry</span> |
||
90 | 00081 <span class="comment">// change these definitions to adapt settings</span> |
||
91 | 00082 <span class="preprocessor">#define LCD_LINES 4 // visible lines</span> |
||
92 | 00083 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE_LENGTH 20 // line length (in characters)</span> |
||
93 | 00084 <span class="preprocessor"></span><span class="comment">// cursor position to DDRAM mapping</span> |
||
94 | 00085 <span class="preprocessor">#define LCD_LINE0_DDRAMADDR 0x00</span> |
||
95 | 00086 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE1_DDRAMADDR 0x40</span> |
||
96 | 00087 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE2_DDRAMADDR 0x14</span> |
||
97 | 00088 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE3_DDRAMADDR 0x54</span> |
||
98 | 00089 <span class="preprocessor"></span> |
||
99 | 00090 <span class="comment">// LCD delay</span> |
||
100 | 00091 <span class="comment">// This delay affects how quickly accesses are made to the LCD controller.</span> |
||
101 | 00092 <span class="comment">// The HD44780 LCD controller requires an access time of at least 1us.</span> |
||
102 | 00093 <span class="comment">// LCD_DELAY should be scaled to take at least half that time (500us).</span> |
||
103 | 00094 <span class="comment">// Each NOP takes 1 CPU clock cycle to execute. Thus, at 4MHz, you should</span> |
||
104 | 00095 <span class="comment">// use at least 2 NOPs, at 8MHz at least 4 NOPs, etc.</span> |
||
105 | 00096 <span class="comment">// You can also use the delay_us(xx) command for longer access times.</span> |
||
106 | 00097 |
||
107 | 00098 <span class="comment">// LCD_DELAY is now automatically set in lcd.h,</span> |
||
108 | 00099 <span class="comment">// however, if you define it here, this definition will override the automatic setting</span> |
||
109 | 00100 |
||
110 | 00101 <span class="comment">// use this for a fail-safe delay</span> |
||
111 | 00102 <span class="comment">//#define LCD_DELAY delay_us(5);</span> |
||
112 | 00103 |
||
113 | 00104 <span class="preprocessor">#endif</span> |
||
114 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by |
||
115 | <a href="http://www.doxygen.org/index.html"> |
||
116 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
117 | </body> |
||
118 | </html> |
Powered by WebSVN v2.8.3