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

How to extract the data for multiple adc in lpc 2138?

Hi I how to extract the data for multiple input to adc port in lpc2138 .
Here is the code for initialization of the adc and tell me how to extract the data for both the adc


void adc_ini(void)
{


                PINSEL1 = 0X05000000; //pin 13 p0.28 and p0.29 adc 0 channel 1 and 2
                PCONP |=  0X00001000;   //select adc 0 bit 12
                AD0CR &=  0X00000000;
                AD0CR |=  0X00200206; // WITH PCLK 12/(2+1)=4MHZ ADC0 CHANNEL 1 and 2 PIN 13 and 14
                AD0INTEN &= 0x00000000; //Completion of a conversion on ADC channel 0 will not generate an interrupt.


}

void adc_data(void)
{
                    AD0CR  |= 0x01000000;              /* Start A/D Conversion         */
                    while((AD0DR & 0x80000000)==0); //until bit 31 is high (DONE)
                    val = AD0DR; //read a/d data register
                    adc_val = ((val >> 6) & 0x3FF);    // Extract AD result
}

How to modify for extracting the data from both the data register ?

Thanks in advance

Parents
  • If software conversion mode can only start the conversion for one (1) channel, and you want to use software conversion mode but use more than one channel - don't you think that you must then use the software conversion mode multiple times?

    So what would then be the logical modification of the source code?

    And exactly how confusing is it to now have two threads that concurrently debates the same problem, after you decided to create two identical threads? Why didn't you post a link in one thread saying that all continued debate should happen in the other - linked - thread?

Reply
  • If software conversion mode can only start the conversion for one (1) channel, and you want to use software conversion mode but use more than one channel - don't you think that you must then use the software conversion mode multiple times?

    So what would then be the logical modification of the source code?

    And exactly how confusing is it to now have two threads that concurrently debates the same problem, after you decided to create two identical threads? Why didn't you post a link in one thread saying that all continued debate should happen in the other - linked - thread?

Children
No data