Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

MSP430G2553 ADC10 ENC clear problem.

$
0
0

Hi,

I am reading two analog pin P1.4 and P1.7 on MSP430g2553. I am using ADC10 single channel single conversation mode in CCS compiler.The problem is I am reading AN4 pin then ı am reading AN7. when I try to read AN7 first I have to set ADC10CTL1=INCH_7 but ıt doesnt allow change it because first have to clear  ADC10CTL0 ENC bit.

  But  I couldnt clear ENC bit.

 

while(1)

{

      ADC10CTL0&=0xFD;                         // try to clear ENC

      ADC10CTL1=INCH_4;                       // P1.4 AN4 ENABLE

      ADC10AE0 = BIT4;                            // P1.4 AN4 ENABLE

      ADC10CTL0=ADC10SHT_2 + ADC10ON + ENC + ADC10SC;

      ADCValue=ADC10MEM;

 

      ADC10CTL0&=0xFD;                         // try to clear ENC

      ADC10CTL1=INCH_7;                       // P1.7 AN7 ENABLE

      ADC10AE0 = BIT7;                            // P1.7 AN7 ENABLE

      ADC10CTL0=ADC10SHT_2 + ADC10ON + ENC + ADC10SC;

      ADCValue=ADC10MEM;

 

}

 

 

On the other hand sequence of channels mode ı am getting wrong values.

unsigned int res[2]; //for holding the conversion results

void main (void) { 
                WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT  

                ADC10CTL1 = INCH_7 + CONSEQ_1;            // A7  once multi channel  

                ADC10CTL0 = ADC10SHT_2 + MSC + ADC10ON;  

                ADC10AE0 = 0x90;                          // P1.4,7 ADC option select  

                ADC10DTC1 = 0x02;                         // 2 conversions  


  for (;;)   {     
 

             ADC10CTL0 &= ~ENC;   

             while (ADC10CTL1 & BUSY);               // Wait if ADC10 core is active   

             ADC10SA = (int)res;                        // Data buffer start    

             ADC10CTL0 |= ENC + ADC10SC;            

 

             }
}

 

When I using ADC10 single channel single conversation mode I can read AN7 and AN4 separately and correctly. But When I use both of them single mode I cant clear ENC bit. This is the firs problem.

 

When I use sequence of channels mode ı cant getting both values correctly or repeatedly adresses.

Can you tell me what are the problems?

Thank you.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>