Proper sequence to read 2 adc channel .

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Proper sequence to read 2 adc channel .

744 Views
lpcware
NXP Employee
NXP Employee
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

}
Labels (1)
0 Kudos
Reply
1 Reply

705 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Sun Aug 04 22:35:07 MST 2013
any help on that..........
0 Kudos
Reply