This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

about PIN configuration in LPC1768

Hi,
I have started to program with lpc1768. In an example code in keil. I see that in this function it defines the pin P0.25 both GPIO and AD0.2, is it possible?
Also I cant figure out how does this code configure GPIO for P0.25 by '= ~(3<<18)'

 void ADC_init (void) {

  LPC_PINCON->PINSEL1 &= ~(3<<18);      /* P0.25 is GPIO                      */
  LPC_PINCON->PINSEL1 |=  (1<<18);      /* P0.25 is AD0.2                     */

  LPC_SC->PCONP       |=  (1<<12);      /* Enable power to ADC block          */

  LPC_ADC->ADCR        =  (1<< 2) |     /* select AD0.2 pin                   */
                          (4<< 8) |     /* ADC clock is 25MHz/5               */
                          (1<<21);      /* enable ADC                         */

  LPC_ADC->ADINTEN     =  (1<< 8);      /* global enable interrupt            */

  NVIC_EnableIRQ(ADC_IRQn);             /* enable ADC Interrupt               */
}

0