Hi everyone, I am trying to sample 2 single-ended channel single with CC2540. Then I treated it as a conversion sequence. But there is a question confused me, that is how to read each channle's result.
The EOC flag in ADCCON1 means the end of the one channle's conversion or the end of the sequence's ( two channles) conversion.
The part of code as follows.
while (!(ADCCON1 & 0x80)); if (ADCCON2 & 0x0F == 0x01) //to read AN0 result { adc_v0 = (int16) (ADCL); adc_v0 |= (int16) (ADCH << 8); } while (!(ADCCON1 & 0x80)); if (ADCCON2 & 0x0F == 0x02) // to read AN1 result { adc_v2 = (int16) (ADCL); adc_v2 |= (int16) (ADCH << 8); }
Is this right ?
When using sequence conversion, it must be using DMA way to get result ?
Thanks a lot!
BR,
Key