I'm using the CC430F5135 to take several readings from the ADC12 module on an analog input port. Each of these readings seem fine. Once I'm done, I turn off the ADC and reset all the control registers:
/* Turn off the ADC */ ADC12CTL0 = 0; ADC12CTL1 = 0; ADC12CTL2 = 0;
When I go to take a new ADC reading on another input channel (like Vdd / 2), the ADC outputs 0x0FFF. The only way to get the ADC to output a correct reading is to put the chip into low power mode. Any low power mode LPM0-3 seems to do the trick - if I just add a line putting the chip to sleep for 1 clock cycle, the ADC works fine again.
Anyone have any ideas why I need to put the chip to sleep, and how to avoid this behavior?
Thanks,
Chad C.
It should be sufficient to clear the ENC bit and then the ADCON and REFON bits to turn the ADC off.While ENC is set, some bits must not be changed. ENC must be cleared first, or the internal ADC state machine might get confused and enter some illegal state.
But that's just a guess - I never had this problem myself.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.