Main Page   Modules   Data Structures   File List   Data Fields   Globals  

ads7828.h

Go to the documentation of this file.
00001 /*! \file ads7828.h \brief TI ADS7828 12-bit 8ch A/D Converter Driver Library. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'ads7828.h'
00005 // Title        : TI ADS7828 12-bit 8ch A/D Converter Driver Library
00006 // Author       : Pascal Stang - Copyright (C) 2004
00007 // Created      : 2004.02.10
00008 // Revised      : 2004.02.19
00009 // Version      : 0.1
00010 // Target MCU   : Atmel AVR Series
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 // This code is distributed under the GNU Public License
00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00019 //
00020 //*****************************************************************************
00021 
00022 #ifndef ADS7828_H
00023 #define ADS7828_H
00024 
00025 #include "global.h"
00026 
00027 // constants/macros/typdefs
00028 #define ADS7828_I2C_ADDR    0x90    //< Base I2C address of ADS7828 devices
00029 
00030 #define ADS7828_CMD_PD0     0x04    //< ADS7828 Power-down bit 0
00031 #define ADS7828_CMD_PD1     0x08    //< ADS7828 Power-down bit 1
00032 #define ADS7828_CMD_C0      0x10    //< ADS7828 Channel Select bit 0
00033 #define ADS7828_CMD_C1      0x20    //< ADS7828 Channel Select bit 1
00034 #define ADS7828_CMD_C2      0x40    //< ADS7828 Channel Select bit 2
00035 #define ADS7828_CMD_SD      0x80    //< ADS7828 Single-ended/Differential Select bit
00036 
00037 #define ADS7828_CMD_CH0     0x00    //< ADS7828 Convert Channel 0
00038 #define ADS7828_CMD_CH1     0x10    //< ADS7828 Convert Channel 1
00039 #define ADS7828_CMD_CH2     0x20    //< ADS7828 Convert Channel 2
00040 #define ADS7828_CMD_CH3     0x30    //< ADS7828 Convert Channel 3
00041 #define ADS7828_CMD_CH4     0x40    //< ADS7828 Convert Channel 4
00042 #define ADS7828_CMD_CH5     0x50    //< ADS7828 Convert Channel 5
00043 #define ADS7828_CMD_CH6     0x60    //< ADS7828 Convert Channel 6
00044 #define ADS7828_CMD_CH7     0x70    //< ADS7828 Convert Channel 7
00045 
00046 #define ADS7828_CMD_PDMODE0 0x00    //< ADS7828 Power-down Mode 0
00047 #define ADS7828_CMD_PDMODE1 0x04    //< ADS7828 Power-down Mode 1
00048 #define ADS7828_CMD_PDMODE2 0x08    //< ADS7828 Power-down Mode 2
00049 #define ADS7828_CMD_PDMODE3 0x0C    //< ADS7828 Power-down Mode 3
00050 
00051 // functions
00052 
00053 //! Initialize the DS1631 chip
00054 u08 ads7828Init(u08 i2cAddr);
00055 
00056 //! Set the voltage reference to use for 
00057 //  ref = 0  =>  External reference voltage on Ref pin
00058 //  ref = 1  =>  Internal 2.5V reference voltage (Ref pin left open)
00059 void ads7828SetReference(u08 ref);
00060 
00061 //! Begin conversion on given channel, and return result
00062 u16 ads7828Convert(u08 i2cAddr, u08 channel);
00063 
00064 #endif

Generated on Sun Feb 22 19:12:30 2004 for Procyon AVRlib by doxygen1.3-rc2