keil_examples/EMAC/easyweb.c
// samples and returns AD-converter value of channel xx
samples and returns AD-converter value of channel xx
samples and returns AD - converter value of channel xx
unsigned int GetTempVal(void)
{
  unsigned int val;
  LPC_ADC->CR = 0x01203104;      
  do {
    val = LPC_ADC->GDR;             
  } while ((val & 0x80000000) == 0);  
  LPC_ADC->CR &= ~0x01000002;       
  val = (val >> 4) & 0x0FFF;        
//  val = (val >> 6) & 0x03FF;          
  return(val / 10);                   
}
unsigned int GetTempVal ( void ) { unsigned int val ; LPC_ADC -> CR = 0x01203104 ; do { val = LPC_ADC -> GDR ; } while ( ( val & 0x80000000 ) == 0 ) ; LPC_ADC -> CR &= ~ 0x01000002 ; val = ( val >> 4 ) & 0x0FFF ; return ( val / 10 ) ; }
samples and returns AD-converter value of channel xx
samples and returns AD - converter value of channel xx
// function replaced to handle LPC17xx A/D converter. // Setup A/D: 12-bit AIN2 @  // Read A/D Data Register // Wait for end of A/D Conversion // Stop A/D Conversion // Extract AIN2 Value //  val = (val >> 6) & 0x03FF;          // Extract AIN2 Value // result of A/D process 