⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcdconf_8h-source.html

📁 avr应用测试程序
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Procyon AVRlib: conf/lcdconf.h Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><div class="nav"><a class="el" href="dir_000000.html">conf</a></div><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>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name    : 'lcdconf.h'</span>00005 <span class="comment">// Title        : Character LCD driver for HD44780/SED1278 displays</span>00006 <span class="comment">//                  (usable in mem-mapped, or I/O mode)</span>00007 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2000-2002</span>00008 <span class="comment">// Created      : 11/22/2000</span>00009 <span class="comment">// Revised      : 4/30/2002</span>00010 <span class="comment">// Version      : 1.1</span>00011 <span class="comment">// Target MCU   : Atmel AVR series</span>00012 <span class="comment">// Editor Tabs  : 4</span>00013 <span class="comment">//</span>00014 <span class="comment">// This code is distributed under the GNU Public License</span>00015 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>00016 <span class="comment">//</span>00017 <span class="comment">//*****************************************************************************</span>00018 00019 <span class="preprocessor">#ifndef LCDCONF_H</span>00020 <span class="preprocessor"></span><span class="preprocessor">#define LCDCONF_H</span>00021 <span class="preprocessor"></span>00022 <span class="comment">// Define type of interface used to access the LCD</span>00023 <span class="comment">//  LCD_MEMORY_INTERFACE:</span>00024 <span class="comment">//      To use this mode you must supply the necessary hardware to connect the</span>00025 <span class="comment">//      LCD to the CPU's memory bus.  The CONTROL and DATA registers of the LCD</span>00026 <span class="comment">//      (HD44780 chip) must appear in the CPU's memory map.  This mode is faster</span>00027 <span class="comment">//      than the port interface but requires a little extra hardware to make it</span>00028 <span class="comment">//      work.  It is especially useful when your CPU is already configured to</span>00029 <span class="comment">//      use an external memory bus for other purposes (like accessing memory).</span>00030 <span class="comment">//</span>00031 <span class="comment">// LCD_PORT_INTERFACE:</span>00032 <span class="comment">//      This mode allows you to connect the control and data lines of the LCD</span>00033 <span class="comment">//      directly to the I/O port pins (no interfacing hardware is needed),</span>00034 <span class="comment">//      but it generally runs slower than the LCD_MEMORY_INTERFACE.</span>00035 <span class="comment">//      Depending on your needs, when using the LCD_PORT_INTERFACE, the LCD may</span>00036 <span class="comment">//      be accessed in 8-bit or 4-bit mode.  In 8-bit mode, one whole I/O port</span>00037 <span class="comment">//      (pins 0-7) is required for the LCD data lines, but transfers are faster.</span>00038 <span class="comment">//      In 4-bit mode, only I/O port pins 4-7 are needed for data lines, but LCD</span>00039 <span class="comment">//      access is slower.  In either mode, three additional port pins are</span>00040 <span class="comment">//      required for the LCD interface control lines (RS, R/W, and E).</span>00041 00042 <span class="comment">// Enable one of the following interfaces to your LCD</span>00043 <span class="comment">//#define LCD_MEMORY_INTERFACE</span>00044 <span class="preprocessor">#define LCD_PORT_INTERFACE</span>00045 <span class="preprocessor"></span>00046 <span class="comment">// Enter the parameters for your chosen interface'</span>00047 <span class="comment">// if you chose the LCD_PORT_INTERFACE:</span>00048 <span class="preprocessor">#ifdef LCD_PORT_INTERFACE</span>00049 <span class="preprocessor"></span><span class="preprocessor">    #ifndef LCD_CTRL_PORT</span>00050 <span class="preprocessor"></span>        <span class="comment">// port and pins you will use for control lines</span>00051 <span class="preprocessor">        #define LCD_CTRL_PORT   PORTC</span>00052 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_CTRL_DDR    DDRC</span>00053 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_CTRL_RS     2</span>00054 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_CTRL_RW     3</span>00055 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_CTRL_E      4</span>00056 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>00057 <span class="preprocessor"></span><span class="preprocessor">    #ifndef LCD_DATA_POUT</span>00058 <span class="preprocessor"></span>        <span class="comment">// port you will use for data lines</span>00059 <span class="preprocessor">        #define LCD_DATA_POUT   PORTA</span>00060 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_DATA_PIN    PINA</span>00061 <span class="preprocessor"></span><span class="preprocessor">        #define LCD_DATA_DDR    DDRA</span>00062 <span class="preprocessor"></span>        <span class="comment">// access mode you will use (default is 8bit unless 4bit is selected)</span>00063         <span class="comment">//#define LCD_DATA_4BIT</span>00064 <span class="preprocessor">    #endif</span>00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00066 <span class="preprocessor"></span>00067 <span class="comment">// if you chose the LCD_MEMORY_INTERFACE:</span>00068 <span class="preprocessor">#ifdef LCD_MEMORY_INTERFACE</span>00069 <span class="preprocessor"></span><span class="preprocessor">    #ifndef LCD_CTRL_ADDR</span>00070 <span class="preprocessor"></span>        <span class="comment">// CPU memory address of the LCD control register</span>00071 <span class="preprocessor">        #define LCD_CTRL_ADDR   0x1000</span>00072 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>00073 <span class="preprocessor"></span><span class="preprocessor">    #ifndef LCD_DATA_ADDR</span>00074 <span class="preprocessor"></span>        <span class="comment">// CPU memory address of the LCD data register</span>00075 <span class="preprocessor">        #define LCD_DATA_ADDR   0x1001</span>00076 <span class="preprocessor"></span><span class="preprocessor">    #endif</span>00077 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00078 <span class="preprocessor"></span>00079 00080 <span class="comment">// LCD display geometry</span>00081 <span class="comment">// change these definitions to adapt settings</span>00082 <span class="preprocessor">#define LCD_LINES               4   // visible lines</span>00083 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE_LENGTH         20  // line length (in characters)</span>00084 <span class="preprocessor"></span><span class="comment">// cursor position to DDRAM mapping</span>00085 <span class="preprocessor">#define LCD_LINE0_DDRAMADDR     0x00</span>00086 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE1_DDRAMADDR     0x40</span>00087 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE2_DDRAMADDR     0x14</span>00088 <span class="preprocessor"></span><span class="preprocessor">#define LCD_LINE3_DDRAMADDR     0x54</span>00089 <span class="preprocessor"></span>00090 <span class="comment">// LCD delay</span>00091 <span class="comment">// This delay affects how quickly accesses are made to the LCD controller.</span>00092 <span class="comment">// The HD44780 LCD controller requires an access time of at least 1us.</span>00093 <span class="comment">// LCD_DELAY should be scaled to take at least half that time (500us).</span>00094 <span class="comment">// Each NOP takes 1 CPU clock cycle to execute.  Thus, at 4MHz, you should</span>00095 <span class="comment">// use at least 2 NOPs, at 8MHz at least 4 NOPs, etc.</span>00096 <span class="comment">// You can also use the delay_us(xx) command for longer access times.</span>00097 00098 <span class="comment">// LCD_DELAY is now automatically set in lcd.h,</span>00099 <span class="comment">// however, if you define it here, this definition will override the automatic setting</span>00100 00101 <span class="comment">// use this for a fail-safe delay</span>00102 <span class="comment">//#define LCD_DELAY delay_us(5);</span>00103 00104 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -