lpcware

Proper sequence to read 2 adc channel .

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by aamir ali on Thu Aug 01 01:41:05 MST 2013
Hi,
I want to scan two adc channels continuously not in burst mode, but in software controlled mode. Should I disable start bit after 1 channel & re enable start bit before second channel. Is it correct way

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

}

Outcomes