📄 ds1631_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: ds1631.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>ds1631.h</h1><a href="ds1631_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file ds1631.h \brief Dallas DS1631 Temperature Sensor Driver Library. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'ds1631.h'</span>00005 <span class="comment">// Title : Dallas DS1631 Temperature Sensor Driver Library</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2004</span>00007 <span class="comment">// Created : 2004.02.10</span>00008 <span class="comment">// Revised : 2004.02.19</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><span class="comment"></span>00017 <span class="comment">/// \ingroup driver_hw</span>00018 <span class="comment">/// \defgroup ds1631 Dallas DS1631 Temperature Sensor Driver (ds1631.c)</span>00019 <span class="comment">/// \code #include "ds1632.h" \endcode</span>00020 <span class="comment">/// \par Overview</span>00021 <span class="comment">/// This library provides high-level functions for accessing the Dallas</span>00022 <span class="comment">/// Semiconductor DS1631 I2C Temperature Sensor.</span>00023 <span class="comment">///</span>00024 <span class="comment">/// The basic specs of the DS1631 are:</span>00025 <span class="comment">/// - operating temperature range -55 to +125 degrees C</span>00026 <span class="comment">/// - high accuracy of +/-0.5C over 0 to +70 degrees C</span>00027 <span class="comment">/// - 8 to 12-bit signed output</span>00028 <span class="comment">/// - thermostat functionality</span>00029 <span class="comment"></span><span class="comment">//</span>00030 <span class="comment">// This code is distributed under the GNU Public License</span>00031 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00032 <span class="comment">//</span>00033 <span class="comment">//*****************************************************************************</span>00034 00035 <span class="preprocessor">#ifndef DS1631_H</span>00036 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_H</span>00037 <span class="preprocessor"></span>00038 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00039 00040 <span class="comment">// constants/macros/typdefs</span><a name="l00041"></a><a class="code" href="ds1631_8h.html#a0">00041</a> <span class="preprocessor">#define DS1631_I2C_ADDR 0x90 </span><span class="comment">///< Base I2C address of DS1631 devices</span>00042 <span class="comment"></span><a name="l00043"></a><a class="code" href="ds1631_8h.html#a1">00043</a> <span class="preprocessor">#define DS1631_CMD_STARTCONV 0x51 </span><span class="comment">///< DS1631 Start conversion command byte</span><a name="l00044"></a><a class="code" href="ds1631_8h.html#a2">00044</a> <span class="comment"></span>#define DS1631_CMD_STOPCONV 0x22 <span class="comment">///< DS1631 Stop conversion command byte</span><a name="l00045"></a><a class="code" href="ds1631_8h.html#a3">00045</a> <span class="comment"></span>#define DS1631_CMD_READTEMP 0xAA <span class="comment">///< DS1631 Read Temperature command byte</span><a name="l00046"></a><a class="code" href="ds1631_8h.html#a4">00046</a> <span class="comment"></span>#define DS1631_CMD_ACCESSTH 0xA1 <span class="comment">///< DS1631 TH read/write command byte</span><a name="l00047"></a><a class="code" href="ds1631_8h.html#a5">00047</a> <span class="comment"></span>#define DS1631_CMD_ACCESSTL 0xA2 <span class="comment">///< DS1631 TL read/write command byte</span><a name="l00048"></a><a class="code" href="ds1631_8h.html#a6">00048</a> <span class="comment"></span>#define DS1631_CMD_ACCESSCONFIG 0xAC <span class="comment">///< DS1631 Config read/write command byte</span><a name="l00049"></a><a class="code" href="ds1631_8h.html#a7">00049</a> <span class="comment"></span>#define DS1631_CMD_SWPOR 0x54 <span class="comment">///< DS1631 Software Reset command byte</span>00050 <span class="comment"></span>00051 <span class="preprocessor">#define DS1631_CONFIG_1SHOT 0x01</span>00052 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_POL 0x02</span>00053 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R0 0x04</span>00054 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R1 0x08</span>00055 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_NVB 0x10</span>00056 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_TLF 0x20</span>00057 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_THF 0x40</span>00058 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_DONE 0x80</span>00059 <span class="preprocessor"></span>00060 <span class="comment">// functions</span>00061 <span class="comment"></span>00062 <span class="comment">//! Initialize the DS1631 chip</span>00063 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a0">ds1631Init</a>(u08 i2cAddr);00064 <span class="comment"></span>00065 <span class="comment">//! Reset the DS1631 chip to its power-on defaults</span>00066 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a1">ds1631Reset</a>(u08 i2cAddr);00067 <span class="comment"></span>00068 <span class="comment">//! Set the configuration byte of the DS1631</span>00069 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a2">ds1631SetConfig</a>(u08 i2cAddr, u08 config);00070 <span class="comment"></span>00071 <span class="comment">//! Get the configuration byte of the DS1631</span>00072 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a3">ds1631GetConfig</a>(u08 i2cAddr);00073 <span class="comment"></span>00074 <span class="comment">//! Start a temperature conversion</span>00075 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a4">ds1631StartConvert</a>(u08 i2cAddr);00076 <span class="comment"></span>00077 <span class="comment">//! Stop a temperature conversion (or stop continuous conversion mode)</span>00078 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a5">ds1631StopConvert</a>(u08 i2cAddr);00079 <span class="comment"></span>00080 <span class="comment">//! Read the result of a temperature conversion</span>00081 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a6">ds1631ReadTemp</a>(u08 i2cAddr);00082 <span class="comment"></span>00083 <span class="comment">//! Set the Temp-High threshold</span>00084 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a7">ds1631SetTH</a>(u08 i2cAddr, s16 value);00085 <span class="comment"></span>00086 <span class="comment">//! Set the Temp-Low threshold</span>00087 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a8">ds1631SetTL</a>(u08 i2cAddr, s16 value);00088 <span class="comment"></span>00089 <span class="comment">//! Get the Temp-High threshold</span>00090 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a9">ds1631GetTH</a>(u08 i2cAddr);00091 <span class="comment"></span>00092 <span class="comment">//! Get the Temp-Low threshold</span>00093 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a10">ds1631GetTL</a>(u08 i2cAddr);00094 00095 <span class="keywordtype">void</span> ds1631WriteTempReg(u08 i2cAddr, u08 cmd, s16 value);00096 s16 ds1631ReadTempReg(u08 i2cAddr, u08 cmd);00097 00098 00099 <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 <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 + -