📄 a2d_8h-source.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: a2d.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 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><h1>a2d.h</h1><a href="a2d_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file a2d.h \brief Analog-to-Digital converter function library. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'a2d.h'</span>00005 <span class="comment">// Title : Analog-to-digital converter functions</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002</span>00007 <span class="comment">// Created : 4/08/2002</span>00008 <span class="comment">// Revised : 4/30/2002</span>00009 <span class="comment">// Version : 1.1</span>00010 <span class="comment">// Target MCU : Atmel AVR series</span>00011 <span class="comment">// Editor Tabs : 4</span>00012 <span class="comment">//</span>00013 <span class="comment">// This code is distributed under the GNU Public License</span>00014 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00015 <span class="comment">//</span><span class="comment"></span>00016 <span class="comment">/// \ingroup driver_avr</span>00017 <span class="comment">/// \defgroup a2d A/D Converter Function Library (a2d.c)</span>00018 <span class="comment">/// \code #include "a2d.h" \endcode</span>00019 <span class="comment">/// \par Overview</span>00020 <span class="comment">/// This library provides an easy interface to the analog-to-digital</span>00021 <span class="comment">/// converter available on many AVR processors. Updated to support</span>00022 <span class="comment">/// the ATmega128.</span>00023 <span class="comment"></span><span class="comment">//</span>00024 <span class="comment">//****************************************************************************</span><span class="comment"></span>00025 <span class="comment">//@{</span>00026 <span class="comment"></span>00027 <span class="preprocessor">#ifndef A2D_H</span>00028 <span class="preprocessor"></span><span class="preprocessor">#define A2D_H</span>00029 <span class="preprocessor"></span>00030 <span class="comment">// defines</span>00031 00032 <span class="comment">// A2D clock prescaler select</span>00033 <span class="comment">// *selects how much the CPU clock frequency is divided</span>00034 <span class="comment">// to create the A2D clock frequency</span>00035 <span class="comment">// *lower division ratios make conversion go faster</span>00036 <span class="comment">// *higher division ratios make conversions more accurate</span><a name="l00037"></a><a class="code" href="group__a2d.html#ga9">00037</a> <span class="preprocessor">#define ADC_PRESCALE_DIV2 0x00 </span><span class="comment">///< 0x01,0x00 -> CPU clk/2</span><a name="l00038"></a><a class="code" href="group__a2d.html#ga10">00038</a> <span class="comment"></span>#define ADC_PRESCALE_DIV4 0x02 <span class="comment">///< 0x02 -> CPU clk/4</span><a name="l00039"></a><a class="code" href="group__a2d.html#ga11">00039</a> <span class="comment"></span>#define ADC_PRESCALE_DIV8 0x03 <span class="comment">///< 0x03 -> CPU clk/8</span><a name="l00040"></a><a class="code" href="group__a2d.html#ga12">00040</a> <span class="comment"></span>#define ADC_PRESCALE_DIV16 0x04 <span class="comment">///< 0x04 -> CPU clk/16</span><a name="l00041"></a><a class="code" href="group__a2d.html#ga13">00041</a> <span class="comment"></span>#define ADC_PRESCALE_DIV32 0x05 <span class="comment">///< 0x05 -> CPU clk/32</span><a name="l00042"></a><a class="code" href="group__a2d.html#ga14">00042</a> <span class="comment"></span>#define ADC_PRESCALE_DIV64 0x06 <span class="comment">///< 0x06 -> CPU clk/64</span><a name="l00043"></a><a class="code" href="group__a2d.html#ga15">00043</a> <span class="comment"></span>#define ADC_PRESCALE_DIV128 0x07 <span class="comment">///< 0x07 -> CPU clk/128</span>00044 <span class="comment"></span>// default value00045 <span class="preprocessor">#define ADC_PRESCALE ADC_PRESCALE_DIV64</span>00046 <span class="preprocessor"></span><span class="comment">// do not change the mask value</span>00047 <span class="preprocessor">#define ADC_PRESCALE_MASK 0x07</span>00048 <span class="preprocessor"></span>00049 <span class="comment">// A2D voltage reference select</span>00050 <span class="comment">// *this determines what is used as the</span>00051 <span class="comment">// full-scale voltage point for A2D conversions</span><a name="l00052"></a><a class="code" href="group__a2d.html#ga18">00052</a> <span class="preprocessor">#define ADC_REFERENCE_AREF 0x00 </span><span class="comment">///< 0x00 -> AREF pin, internal VREF turned off</span><a name="l00053"></a><a class="code" href="group__a2d.html#ga19">00053</a> <span class="comment"></span>#define ADC_REFERENCE_AVCC 0x01 <span class="comment">///< 0x01 -> AVCC pin, internal VREF turned off</span><a name="l00054"></a><a class="code" href="group__a2d.html#ga20">00054</a> <span class="comment"></span>#define ADC_REFERENCE_RSVD 0x02 <span class="comment">///< 0x02 -> Reserved</span><a name="l00055"></a><a class="code" href="group__a2d.html#ga21">00055</a> <span class="comment"></span>#define ADC_REFERENCE_256V 0x03 <span class="comment">///< 0x03 -> Internal 2.56V VREF</span>00056 <span class="comment"></span>// default value00057 <span class="preprocessor">#define ADC_REFERENCE ADC_REFERENCE_AVCC</span>00058 <span class="preprocessor"></span><span class="comment">// do not change the mask value</span>00059 <span class="preprocessor">#define ADC_REFERENCE_MASK 0xC0</span>00060 <span class="preprocessor"></span>00061 <span class="comment">// bit mask for A2D channel multiplexer</span>00062 <span class="preprocessor">#define ADC_MUX_MASK 0x1F</span>00063 <span class="preprocessor"></span>00064 <span class="comment">// channel defines (for reference and use in code)</span>00065 <span class="comment">// these channels supported by all AVRs with A2D</span>00066 <span class="preprocessor">#define ADC_CH_ADC0 0x00</span>00067 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC1 0x01</span>00068 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC2 0x02</span>00069 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC3 0x03</span>00070 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC4 0x04</span>00071 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC5 0x05</span>00072 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC6 0x06</span>00073 <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_ADC7 0x07</span><a name="l00074"></a><a class="code" href="group__a2d.html#ga33">00074</a> <span class="preprocessor"></span><span class="preprocessor">#define ADC_CH_122V 0x1E </span><span class="comment">///< 1.22V voltage reference</span><a name="l00075"></a><a class="code" href="group__a2d.html#ga34">00075</a> <span class="comment"></span>#define ADC_CH_AGND 0x1F <span class="comment">///< AGND</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -