/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name          : Readme.txt
* Author             : MCD Application Team
* Version            : V4.0
* Date               : 10/09/2007
* Description        : Description of the ADC Polling Example.
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

Example description
===================
 This example shows how to use  the ADC12 in single channel conversion mode. 
 It aims to display in the hyperterminal the analog input value converted 
 in V. The calibration is performed by determining the ADC12 quatium in V. 
 This is done by computing the average of 1000 ADC conversion result of 0V and 
 2.5V and then calibrating the ADC conversion result. 

 First, apply 0V and press NXT push button on the mb393 board to display
 the 0V conversion result. Then apply 2.5V and display the conversion result 
 by pressing the NXT push button. Then, press NXT push button once again 
 to display and compute the ADC quatium.
 Finally, press again the NXT push button to display the voltage value of 
 the analog signal in V .
 You can change the analog input value (0v to 2.5V) and display the result in V 
 on the Windows hyperterminal.   

  
 This example demonstrates the following features of the ADC12 :

  - The use of the converter in the single channel conversion mode,
  - The ADC12 sampling frequency configuration.

  It is made of the following parts :

  1) GPIO peripheral configuration
    - Configure the used analog input to high impedance Analog input (channel 3 
      in this example)
    - Configure the pin 9 of GPIO1 to input tristate TTL
    - Configure the GPIO0 port to output push-pull
    - Switch on the four leds on GPIO0

  2) Converter configuration
    - Initialize the converter,
    - Configure sampling frequency,
    - Configure the conversion mode,
    - Select the channel to be converted,
    - Start the conversion.

  3) Get the conversion Data Average for 0V
    - Wait until the NXT push button is pressed
    - Compute the average of 1000 ADC conversion result for 0V. This is done 
      using the ADC12_ConversionAverage() function.  
    - The led on GPIO.0 is switched off    
    
 4) Get the conversion Data Average for 2.5V
    - Wait until the NXT push button is pressed
    - Compute the average of 1000 ADC conversion result for 2.5V. This is done 
      using the ADC12_ConversionAverage() function.
    - The led on GPIO.1 is switched off  

 6) Compute the ADC quatium in V
   - Calibrate the Conversion Data Average for 0V to have a  12-bit unsigned 
     value using the function ADC12_UnsigValue() 
   - Calibrate the Conversion Data Average for 2.5V to have a  12-bit unsigned 
     value using the function ADC12_UnsigValue()
   - Calculate the ADC quatium using these values.
   - Wait until NXT push button is pressed

 7) Compute the ADC analog input in V
    - Wait until the ADC conversion data on channel3 is available 
   - Calibrate this conversion result to have a 12-bit unsigned value using the 
     function ADC12_UnsigValue()
   - Compute the ADC analog input in V using the ADC quatium and display it 
     on the Windows hyperterminal.



Directory contents
==================
 71x_conf.h  Library Configuration file
 71x_it.c    Interrupt handlers
 71x_it.h    Interrupt handlers header file
 main.c      Main program



Hardware environment
==================== 
This example requires at least 0V and 2.5V on the ADC analog channel 3. 
 - On the STR71x-Eval board (mb393), the 0V can be applied by plugging the jumper 
   CN6.
 - 2.5V is required on the ADC analog channel 3.
 - The analog signal should be input on ADC analog channel 3.

Connect the COM A port on the STR71x-Eval board (mb393) using a serial link to a PC
- Hyperterminal configuration:
    - Word Length = 8 Bits
    - 1 Stop Bit
    - No parity
    - BaudRate = 9600 baud
    - flow control: None  

 
How to use it
=============
In order to make the program work, you must do the following :
- Create a project and setup all your toolchain's start-up files
- Compile the directory content files and required Library files :
  + 71x_lib.c
  + 71x_adc12.c
  + 71x_apb.c
  + 71x_gpio.c
  + 71x_rccu.c
  + 71x_uart.c

- Link all compiled files and load your image into either RAM or FLASH
- Run the example


******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****
