projekty/Source/example1/src/AnalogDevices.h

Go to the documentation of this file.
00001 /*
00002  * $Id: AnalogDevices.h,v 1 2005/07/04 12:00:00 BorisK Exp $
00003  *
00004  * Copyright (C) 2005 ONTRACK s.r.o.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    
00019  * 02111-1307, USA.
00020  *
00021  * [1] ARM-based Microcontroller LPC2119/2129/2194/2292/9994, "Preliminary User Manual", February 03, 2004
00022  * [2] 80C51 FAMILY DERIVATES - 8XC552/562 overview, 1996 Aug 06, 
00023  *       http://www.semiconductors.philips.com/acrobat/various/8XC552_562OVERVIEW_2.pdf
00024  * [3] AD7414 - SMBus/I2C Digital Temperature Sensor in 6-Pin SOT with SMBus Alert and Over     Temperature Pin, 2003, AnalogDevices, http://www.analog.com/UploadedFiles/Data_Sheets/723837220AD7414_5_e.pdf
00025  * [4] AD5382 - 32-Channel, 3V/5VSingleSupply 14-bit,Voltage-OutputDAC
00026  http://www.analog.com/UploadedFiles/Data_Sheets/176040271AD5382_a.pdf
00027  * Written by Boris Kralik <kralikbo@yahoo.com>, 2005
00028  * [5] AD5390/AD5391/AD5392 , 8/16-Channel, 3 V/5 V,Serial input, Single-Supply, 12/14-Bit Voltage Output http://www.analog.com/en/prod/0%2C2877%2CAD5391%2C00.html 
00029  *
00030  */
00031 #ifndef ANALOGDEVICES_H
00032 #define ANALOGDEVICES_H
00033 
00034 #define AD_DBG  1
00035 /******** (AS as Folat) ******************/
00036 #define I2C_AD7414_0_W_F        0x90    // 1001 0000 [3]        CHA
00037 #define I2C_AD7415_0_W_F        0x90    //[3]
00038 
00039 #define I2C_AD7414_0_R_F        0x91    // 1001 0001 [3]        CHA
00040 #define I2C_AD7415_0_R_F        0x91    //[3]
00041 /******** (AS as GND) ******************/
00042 #define I2C_AD7414_0_W_GND      0x92    // 1001 0100 [3]        CHA
00043 #define I2C_AD7415_0_W_GND      0x92    //[3]
00044 
00045 #define I2C_AD7414_0_R_GND      0x93    // 1001 0101 [3]        CHA
00046 #define I2C_AD7415_0_R_GND      0x93    //[3]
00047 /******** (AS as VDD) ******************/
00048 #define I2C_AD7414_0_W_VDD      0x94    // 1001 1010 [3]        CHA
00049 #define I2C_AD7415_0_W_VDD      0x94    //[3]   CGB ???
00050 
00051 #define I2C_AD7414_0_R_VDD      0x95    // 1001 1011 [3]        CHB
00052 #define I2C_AD7415_0_R_VDD      0x95    //[3]   CGB ???
00053 /******** (AS as GND) ******************/
00054 #define I2C_AD7414_1_W_GND      0x9A    //[3]                   CHB
00055 #define I2C_AD7415_1_W_GND      0x9A    //[3]
00056 
00057 #define I2C_AD7414_1_R_GND      0x9B    //                      CHB
00058 #define I2C_AD7415_1_R_GND      0x9B
00059 /******** (AS as VDD) ******************/
00060 #define I2C_AD7414_1_W_VDD      0x9C    //[3]                   CHB
00061 #define I2C_AD7415_1_W_VDD      0x9C    //[3]
00062 
00063 #define I2C_AD7414_1_R_VDD      0x9D    //                      CHB
00064 #define I2C_AD7415_1_R_VDD      0x9D    //                      CHB
00065 /******** (AD7414-2) ******************/
00066 #define I2C_AD7414_2_W  0x96            //                      CHC
00067 #define I2C_AD7414_2_R  0x97
00068 /******** (AD7414-3) ******************/
00069 #define I2C_AD7414_3_W  0x9E    //[3]                           CHD
00070 #define I2C_AD7414_3_R  0x8F    //[3]
00071 /********************************************************/
00072 #define I2C_AD5382_W    0xAE    //[4] page 25
00073 #define I2C_AD5382_R    0xAF    //[4]
00074 
00075 #define I2C_AD5391_W    0xAC    //[5] page 26
00076 #define I2C_AD5391_R    0xAD    //[5]
00077 
00078 #define I2C_AD7997BRU_1_H_W     0x48    // AD7997BRU-1  AS = H
00079 #define I2C_AD7997BRU_1_H_R     0x49
00080 
00081 #define I2C_AD7997BRU_1_L_W     0x46    // AD7997BRU-1  AS = L
00082 #define I2C_AD7997BRU_1_L_R     0x47
00083 
00084 
00085 /* AD7997  Mode 2 */
00086 #define AD7997_CONF_REG 0x02
00087 #define AD7997_RES_REG  0x00
00088 #define AD7997_STR_REG  0x03
00089 
00090         
00091 #include "types.h"
00092 #include "lpc229x.h"
00093 #include "I2C.h"
00094 
00095 int16_t AD7414_5Read(uint8_t);
00096 
00097 int16_t AD5382Write(short,uint16_t inp);
00098 short AD5382_SetGain(short,uint16_t);
00099 short AD5382_SetOffset(short,uint16_t);
00100 void AD5382_SoftClr(void);
00101 short AD5382_SoftReset(void);
00102 short AD5382_SoftPowerDown(void);
00103 short AD5382_SoftPowerUp(void);
00104 short AD5382_ControlRegister(void);
00105 
00106 /*AD5391 Not Completed */
00107 int16_t AD5391Write(short,uint16_t);
00108 short AD5391_Init(void);
00109 short AD5391_SetGain(short,uint16_t);
00110 short AD5391_SetOffset(short,uint16_t);
00111 void AD5391_SoftClr(void);
00112 void AD5391_SoftReset(void);
00113 void AD5391_SoftPowerDown(void);
00114 void AD5391_SoftPowerUp(void);
00115 short AD5391_ControlRegisterWrite(void);
00116 short AD5391_ControlRegisterRead(void);
00117 
00118 int16_t AD7997_ReadAnalogValue(short);
00119 short AD7997_SetCycleTimeRegister(short);
00120 void AD7997_ConfigRegister(short);      //Write Config register
00121 
00122 #define TEMPERATURE 0
00123 #endif

Generated on Fri Sep 21 13:41:54 2007 for example1 by  doxygen 1.4.7