?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik /*! \file ads7828.h \brief TI ADS7828 12-bit 8ch A/D Converter Driver Library. */
2 //*****************************************************************************
3 //
4 // File Name : 'ads7828.h'
5 // Title : TI ADS7828 12-bit 8ch A/D Converter Driver Library
6 // Author : Pascal Stang - Copyright (C) 2004
7 // Created : 2004.02.10
8 // Revised : 2004.02.19
9 // Version : 0.1
10 // Target MCU : Atmel AVR Series
11 // Editor Tabs : 4
12 //
13 // NOTE: This code is currently below version 1.0, and therefore is considered
14 // to be lacking in some functionality or documentation, or may not be fully
15 // tested. Nonetheless, you can expect most functions to work.
16 //
17 // This code is distributed under the GNU Public License
18 // which can be found at http://www.gnu.org/licenses/gpl.txt
19 //
20 /// \ingroup driver_hw
21 /// \defgroup ads7828 TI ADS7828 I2C A/D Converter Driver (ads7828.c)
22 /// \code #include "ads7828.h" \endcode
23 /// \par Overview
24 /// This library provides high-level functions for accessing the Texas
25 /// Instruments ADS7828 I2C A/D Converter.
26 ///
27 /// The basic specs of the ADS7828 are:
28 /// - 12-bit results
29 /// - 8 input channels
30 /// - up to 50KHz conversion rate
31 /// - External reference or internal 2.5V reference
32 //
33 //*****************************************************************************
34 //@{
35  
36 #ifndef ADS7828_H
37 #define ADS7828_H
38  
39 #include "global.h"
40  
41 // constants/macros/typdefs
42 #define ADS7828_I2C_ADDR 0x90 ///< Base I2C address of ADS7828 devices
43  
44 // command register bit defines
45 #define ADS7828_CMD_PD0 0x04 ///< ADS7828 Power-down bit 0
46 #define ADS7828_CMD_PD1 0x08 ///< ADS7828 Power-down bit 1
47 #define ADS7828_CMD_C0 0x10 ///< ADS7828 Channel Select bit 0
48 #define ADS7828_CMD_C1 0x20 ///< ADS7828 Channel Select bit 1
49 #define ADS7828_CMD_C2 0x40 ///< ADS7828 Channel Select bit 2
50 #define ADS7828_CMD_SD 0x80 ///< ADS7828 Single-ended/Differential Select bit
51  
52 // single-ended channel order defines
53 #define ADS7828_CMD_CH0 0x00 ///< ADS7828 Convert Channel 0
54 #define ADS7828_CMD_CH1 0x04 ///< ADS7828 Convert Channel 1
55 #define ADS7828_CMD_CH2 0x01 ///< ADS7828 Convert Channel 2
56 #define ADS7828_CMD_CH3 0x05 ///< ADS7828 Convert Channel 3
57 #define ADS7828_CMD_CH4 0x02 ///< ADS7828 Convert Channel 4
58 #define ADS7828_CMD_CH5 0x06 ///< ADS7828 Convert Channel 5
59 #define ADS7828_CMD_CH6 0x03 ///< ADS7828 Convert Channel 6
60 #define ADS7828_CMD_CH7 0x07 ///< ADS7828 Convert Channel 7
61  
62 // power-down mode defines
63 #define ADS7828_CMD_PDMODE0 0x00 ///< ADS7828 Power-down Mode 0
64 #define ADS7828_CMD_PDMODE1 0x04 ///< ADS7828 Power-down Mode 1
65 #define ADS7828_CMD_PDMODE2 0x08 ///< ADS7828 Power-down Mode 2
66 #define ADS7828_CMD_PDMODE3 0x0C ///< ADS7828 Power-down Mode 3
67  
68 // functions
69  
70 //! Initialize the ADS7828 chip.
71 /// Returns:
72 /// TRUE if successful,
73 /// FALSE if unsuccessful (chip not present).
74 u08 ads7828Init(u08 i2cAddr);
75  
76 //! Set the voltage reference to use for A/D conversion.
77 /// - ref = 0 => External reference voltage on Ref pin.
78 /// - ref = 1 => Internal 2.5V reference voltage (Ref pin left open).
79 void ads7828SetReference(u08 ref);
80  
81 //! Begin single-ended conversion on given logical channel#, and return result.
82 u16 ads7828Convert(u08 i2cAddr, u08 channel);
83  
84 //! Begin differential conversion on given channel pair, and return result.
85 u16 ads7828ConvertDiff(u08 i2cAddr, u08 channel);
86  
87 //! Begin conversion on given raw channel#, and return result.
88 u16 ads7828ConvertRaw(u08 i2cAddr, u08 channel);
89  
90 #endif
91 //@}
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3