while(1) { /* scan channel 1 */ LPC_ADC->CR = 0x00000601; // select channel one LPC_ADC->CR = (LPC_ADC->CR & 0x0FC1FFFF) | (BIT_24); // enable start conversion while(!(LPC_ADC->STAT & 0x00000001)); // wait while conversion // read the value of channel 1 LPC_ADC->CR = (LPC_ADC->CR & 0x0FC1FFFF) & (~(BIT_24)); //disable start bit is it necessary here /* scan channel 2 */ LPC_ADC->CR = 0x00000602; // select channel one LPC_ADC->CR = (LPC_ADC->CR & 0x0FC1FFFF) | (BIT_24); // enable start conversion while(!(LPC_ADC->STAT & 0x00000002)); // wait while conversion // read the value of channel 2 LPC_ADC->CR = (LPC_ADC->CR & 0x0FC1FFFF) & (~(BIT_24)); //disable start bit is it necessary here } |