?lang_form?
?lang_select?
?lang_submit?
?lang_endform?
{HEADER END}
{FILE START}
library
?curdirlinks? - Rev 6
?prevdifflink? - Blame - ?getfile?
<!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: ads7870.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>ads7870.h</h1><a href="ads7870_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file ads7870.h \brief TI ADS7870 12-bit 8ch A/D Converter Driver Library. */</span>
00002 <span class="comment">//*****************************************************************************</span>
00003 <span class="comment">//</span>
00004 <span class="comment">// File Name : 'ads7870.h'</span>
00005 <span class="comment">// Title : TI ADS7870 12-bit 8ch A/D Converter Driver Library</span>
00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2005</span>
00007 <span class="comment">// Created : 2005.07.19</span>
00008 <span class="comment">// Revised : 2005.07.21</span>
00009 <span class="comment">// Version : 0.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">// NOTE: This code is currently below version 1.0, and therefore is considered</span>
00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span>
00015 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span>
00016 <span class="comment">//</span>
00017 <span class="comment">// This code is distributed under the GNU Public License</span>
00018 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>
00019 <span class="comment">//</span><span class="comment"></span>
00020 <span class="comment">/// \ingroup driver_hw</span>
00021 <span class="comment">/// \defgroup ads7870 TI ADS7870 SPI A/D Converter Driver (ads7870.c)</span>
00022 <span class="comment">/// \code #include "ads7870.h" \endcode</span>
00023 <span class="comment">/// \par Overview</span>
00024 <span class="comment">/// This library provides high-level functions for accessing the Texas</span>
00025 <span class="comment">/// Instruments ADS7870 I2C A/D Converter.</span>
00026 <span class="comment">///</span>
00027 <span class="comment">/// The basic specs of the ADS7870 are:</span>
00028 <span class="comment">/// - Fast SPI interface (up to 20MHz)</span>
00029 <span class="comment">/// - 12-bit results</span>
00030 <span class="comment">/// - 8 single-ended or 4 differential input channels</span>
00031 <span class="comment">/// - Programmable gain stage (1,2,4,5,8,10,16,20x gains)</span>
00032 <span class="comment">/// - Software or hardware triggered conversion</span>
00033 <span class="comment">/// - 4-bit auxiliary digital I/O lines (controlled via serial interface)</span>
00034 <span class="comment">/// - Up to 50KHz conversion rate</span>
00035 <span class="comment">/// - External reference or internal 2.5V, 2.048V, 1.15V reference</span>
00036 <span class="comment">/// - NOTE: use pin-compatible ADS7871 for 14-bit results</span>
00037 <span class="comment"></span><span class="comment">//</span>
00038 <span class="comment">//*****************************************************************************</span><span class="comment"></span>
00039 <span class="comment">//@{</span>
00040 <span class="comment"></span>
00041 <span class="preprocessor">#ifndef ADS7870_H</span>
00042 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_H</span>
00043 <span class="preprocessor"></span>
00044 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
00045
00046 <span class="comment">// constants/macros/typdefs</span>
00047 <span class="preprocessor">#define ADS7870_CS_PORT PORTB</span>
00048 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CS_DDR DDRB</span>
00049 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CS_PIN PB0</span>
00050 <span class="preprocessor"></span>
00051 <span class="comment">// instruction bit defines</span>
00052 <span class="preprocessor">#define ADS7870_CONVERT 0x80</span>
00053 <span class="preprocessor"></span>
00054 <span class="preprocessor">#define ADS7870_REG_READ 0x40</span>
00055 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REG_WRITE 0x00</span>
00056 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REG_16BIT 0x20</span>
00057 <span class="preprocessor"></span>
00058 <span class="comment">// register addresses</span>
00059 <span class="preprocessor">#define ADS7870_RESULTLO 0x00</span>
00060 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_RESULTHI 0x01</span>
00061 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_PGAVALID 0x02</span>
00062 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ADCTRL 0x03</span>
00063 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAINMUX 0x04</span>
00064 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_DIGIOSTATE 0x05</span>
00065 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_DIGIOCTRL 0x06</span>
00066 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC 0x07</span>
00067 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_SERIFCTRL 0x18</span>
00068 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ID 0x1F</span>
00069 <span class="preprocessor"></span>
00070 <span class="comment">// register bit defines</span>
00071 <span class="preprocessor">#define ADS7870_RESULTLO_OVR 0x01</span>
00072 <span class="preprocessor"></span>
00073 <span class="preprocessor">#define ADS7870_ADCTRL_BIN 0x20</span>
00074 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ADCTRL_RMB1 0x08</span>
00075 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ADCTRL_RMB0 0x04</span>
00076 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ADCTRL_CFD1 0x02</span>
00077 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_ADCTRL_CFD0 0x01</span>
00078 <span class="preprocessor"></span>
00079 <span class="preprocessor">#define ADS7870_GAINMUX_CNVBSY 0x80</span>
00080 <span class="preprocessor"></span>
00081 <span class="preprocessor">#define ADS7870_REFOSC_OSCR 0x20</span>
00082 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC_OSCE 0x10</span>
00083 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC_REFE 0x08</span>
00084 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC_BUFE 0x04</span>
00085 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC_R2V 0x02</span>
00086 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_REFOSC_RBG 0x01</span>
00087 <span class="preprocessor"></span>
00088 <span class="preprocessor">#define ADS7870_SERIFCTRL_LSB 0x01</span>
00089 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_SERIFCTRL_2W3W 0x02</span>
00090 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_SERIFCTRL_8051 0x04</span>
00091 <span class="preprocessor"></span>
00092 <span class="preprocessor">#define ADS7870_ID_VALUE 0x01</span>
00093 <span class="preprocessor"></span>
00094 <span class="comment">// gain defines</span>
00095 <span class="preprocessor">#define ADS7870_GAIN_1X 0x00</span>
00096 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_2X 0x10</span>
00097 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_4X 0x20</span>
00098 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_5X 0x30</span>
00099 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_8X 0x40</span>
00100 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_10X 0x50</span>
00101 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_16X 0x60</span>
00102 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_GAIN_20X 0x70</span>
00103 <span class="preprocessor"></span><span class="comment">// channel defines</span>
00104 <span class="preprocessor">#define ADS7870_CH_0_1_DIFF 0x00</span>
00105 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_2_3_DIFF 0x01</span>
00106 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_4_5_DIFF 0x02</span>
00107 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_6_7_DIFF 0x03</span>
00108 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_1_0_DIFF 0x04</span>
00109 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_3_2_DIFF 0x05</span>
00110 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_5_4_DIFF 0x06</span>
00111 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_7_6_DIFF 0x07</span>
00112 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_SINGLE_ENDED 0x08</span>
00113 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_0 0x08</span>
00114 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_1 0x09</span>
00115 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_2 0x0A</span>
00116 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_3 0x0B</span>
00117 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_4 0x0C</span>
00118 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_5 0x0D</span>
00119 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_6 0x0E</span>
00120 <span class="preprocessor"></span><span class="preprocessor">#define ADS7870_CH_7 0x0F</span>
00121 <span class="preprocessor"></span>
00122 <span class="comment">// functions</span>
00123 <span class="comment"></span>
00124 <span class="comment">//! Initialize the ADS7870 chip.</span>
00125 <span class="comment">/// Returns:</span>
00126 <span class="comment">/// TRUE if successful, </span>
00127 <span class="comment">/// FALSE if unsuccessful (chip not responding).</span>
00128 <span class="comment"></span>u08 <a class="code" href="group__ads7870.html#ga0">ads7870Init</a>(<span class="keywordtype">void</span>);
00129 <span class="comment"></span>
00130 <span class="comment">//! Begin single-ended conversion on given logical channel#0-7, and return result.</span>
00131 <span class="comment">/// \note Result is returned left-justified.</span>
00132 <span class="comment"></span>s16 <a class="code" href="group__ads7870.html#ga1">ads7870Convert</a>(u08 channel);
00133 <span class="comment"></span>
00134 <span class="comment">//! Begin differential conversion on given channel pair, and return result.</span>
00135 <span class="comment">/// \note Result is returned left-justified.</span>
00136 <span class="comment"></span>s16 <a class="code" href="group__ads7870.html#ga2">ads7870ConvertDiff</a>(u08 channel);
00137 <span class="comment"></span>
00138 <span class="comment">//! Begin conversion on given raw channel#, and return result.</span>
00139 <span class="comment">/// \note Result is returned left-justified.</span>
00140 <span class="comment"></span>s16 <a class="code" href="group__ads7870.html#ga3">ads7870ConvertRaw</a>(u08 channel);
00141 <span class="comment"></span>
00142 <span class="comment">//! Read value from ADS7870 register.</span>
00143 <span class="comment">///</span>
00144 <span class="comment"></span>u08 <a class="code" href="group__ads7870.html#ga4">ads7870ReadReg</a>(u08 reg);
00145 <span class="comment"></span>
00146 <span class="comment">//! Write value into ADS7870 register.</span>
00147 <span class="comment">///</span>
00148 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__ads7870.html#ga5">ads7870WriteReg</a>(u08 reg, u08 value);
00149
00150
00151
00152 <span class="preprocessor">#endif</span>
00153 <span class="preprocessor"></span><span class="comment">//@}</span>
</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by
<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>
|
{FILE END}
{FOOTER START}
Powered by WebSVN v2.8.3