We are trying to read analog voltage supplied to two channels simultaneously using ADC10 and DTC.
We are not getting the results of conversions. Our code is as follows:
ADC10CTL1 = INCH_2 + CONSEQ_1;
ADC10CTL0 = REF2_5V + SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
ADC10AE0 |= 0x06;
ADC10DTC1 = 0x02;
ADC10SA = 0x200; // Data buffer start
while (1)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY);
ADC10SA = 0x200;
ADC10CTL0 |= ENC + ADC10SC; //Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enabled
}
and, the ISR is:
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{ int * read = 0x200;
//code that reads from the location 'read'
__bic_SR_register_on_exit(LPM3_bits); // Clear LPM3 bit from 0(SR)
}
While we are getting the results back at AP, they do not show the correct value, and the value doesn't change if the supplied voltage changes. How do we make sure that an interrupt is generated only when the conversion is complete?
Thanks a lot for your time.