Post Go back to editing

ADC in continuous mode

Category: Datasheet/Specs
Product Number: ADuC832

How do I prevent reading wrong ADC results in continuous mode?

The result is updated in ADCDATAH and ADCDATAL independent of my coding reading the registers (in 2 mov instructions).

How can I be sure I'm not reading a high byte and a low byte that are from a different conversion?

Parents Reply
  • Hi,

            That is what is mentioned in the documents shared above.

    To summarize here:

    For starting the conversion:

    - Either powering on ADC, or

    - Timer 2 conversion bit (T2C) in ADCCON1 or

    - external trigger

    is used as the ADC convert start trigger input. 

    ADC conversion time is set by ADCCON0[CK0, CK1]. A typical ADC conversion requires 17 ADC clocks.

    At the end of this period, ADC conversion gets completed. The ADC interrupt bit ADCI is set by hardware and ADCDATAH and ADCDATAL contain the new ADC conversion results.

    ADC automatically starts next conversion. 

Children
  • Hello,

    If I understand you correctly:

    If I don't want to use DMA, there is no way continuous conversion can be used reliably, unless I

    would use interrupts, or poll the interrupt bit (and clear it) in software?

    But the above mentioned methods (using interrupt or software polling) don't offer any advantages to using single

    conversion.

    IF I can't read the ADC on the fly in continuous conversion mode, I have no use for it.

    So I'll just stick to single conversion.

    Regards

  • Hi,

      You can of course not read any register which is dynamically updated unless it is brought to stable state each time.

      The data written in ADCDATAH and ADCDATAL can be continuously read on DPRAM or a terminal, which is the purpose of DMA.