Content originally posted in LPCWare by edlikestoboogie on Mon Mar 07 10:41:08 MST 2011
Hi,
I am having trouble formulating the correct bitwise operations to power on the ADC, and turn on the first 6 channels of the ADC and configure them for input.
In the example I am looking at, ADC channel 2 is turned on:
/* Configure AD0.2 input. */
LPC_PINCON->PINSEL1 &= 0xFFF3FFFF;
LPC_PINCON->PINSEL1 |= 0x00040000;
LPC_SC->PCONP |= 0x00001000;
LPC_ADC->ADCR = 0x00200404;
/* ADC enable, ADC clock 25MHz/5, select AD0.2 pin */
Can someone please give me a line by line explanation of how these calculations were made? and advise me on what I should do to turn on the first 6 channels, AD0.0, AD0.1, AD0.2, AD0.3, AD0.4, AD0.5 on for input? The first two lines confuse me the most.
Thank you.