Line 34: Line 34:
 
   while(1)
 
   while(1)
 
     {
 
     {
/*Get the adc value of channel zero */
+
/*Get the adc value of channel five */
 
adc_result= ADC_GetAdcValue(5);
 
adc_result= ADC_GetAdcValue(5);
 
 

Revision as of 13:03, 18 March 2015

Amruta (talk) 13:28, 17 March 2015 (IST)


Basics

Schematic

Code

  1. /*-----------------------------------------------------------------------------
  2. note :
  3. Refer adc.h to enable ADC channels.
  4. ------------------------------------------------------------------------------*/
  5. #include "lpc17xx.h" //device specific heaader file
  6. #include "uart.h" //Explore Embedded UART library which conatins the lcd routines
  7. #include "adc.h" //Explore Embedded ADC library which conatins the adc routines
  8.  
  9. /* start the main program */
  10. int main()
  11. {
  12. uint16_t adc_result;
  13.  
  14. /* Setup and initialize the microcontroller system */
  15. SystemInit();
  16.  
  17. /* Initialize the UART before displaying any thing on the lcd */
  18. UART_Init(UART0,9600);
  19.  
  20. /* Initialize the adc before starting the conversion */
  21. ADC_Init();
  22.  
  23. /* Display "ADC Channel zero" on first line*/
  24. UART_Printf("ADC Channel zero");
  25.  
  26. /* Display the adc channel zero value continously */
  27. while(1)
  28. {
  29. /*Get the adc value of channel five */
  30. adc_result= ADC_GetAdcValue(5);
  31.  
  32. /*Display the adc value on UART*/
  33. UART_Printf("\n %u",adc_result);
  34. }
  35. }