1 /* This file has been prepared for Doxygen automatic documentation generation.*/
\r
2 /*! \file *********************************************************************
\r
5 * Headerfile for ADC.c
\r
7 * Contains definitions for ADC setup, and minimum supply voltage.
\r
9 * \par Application note:
\r
10 * AVR458: Charging Li-Ion Batteries with BC100
\r
12 * \par Documentation:
\r
13 * For comprehensive code documentation, supported compilers, compiler
\r
14 * settings and supported devices see readme.html
\r
17 * Atmel Corporation: http://www.atmel.com \n
\r
18 * Support email: avr@atmel.com \n
\r
19 * Original author: \n
\r
24 * $URL: http://svn.norway.atmel.com/AppsAVR8/avr458_Charging_Li-Ion_Batteries_with_BC100/tag/20070904_release_1.0/code/IAR/ADC.h $
\r
25 * $Date: 2007-08-10 09:28:35 +0200 (fr, 10 aug 2007) $\n
\r
26 ******************************************************************************/
\r
31 #include <avr/eeprom.h>
\r
33 //******************************************************************************
\r
35 //******************************************************************************
\r
36 // 8MHz / (25x128) = 2500 samples/s/ch
\r
37 #define ADC_PRESCALER 0x07
\r
38 /*!< \brief Prescaling of ADC clock.
\r
40 * The ADC will run at 8 MHz (system clock) divided by 128
\r
41 * (prescaler), and every sample will takes approximately 25 ticks:
\r
42 * Sample rate = 8 MHz / (128 * 25 cycles/sample) = 2.5 k samples/sec
\r
46 //******************************************************************************
\r
47 // Minimum supply voltage
\r
48 //******************************************************************************
\r
49 //! Minimum supply voltage (at TP101 = VIN+), in mV.
\r
50 #define VIN_MIN 4400
\r
53 //******************************************************************************
\r
55 //******************************************************************************
\r
56 extern unsigned char EEMEM VBAT_RANGE;
\r
57 extern volatile ADC_Status_t ADCS;
\r
60 //******************************************************************************
\r
61 // Function prototypes
\r
62 //******************************************************************************
\r
63 unsigned int ScaleU(unsigned char setting, unsigned int data);
\r
64 unsigned int ScaleI(unsigned char setting, unsigned int data);
\r
65 void ADC_Wait(void);
\r
66 void ADC_Init(void);
\r