AnsweredAssumed Answered

ADuC7060 ADC questions

Question asked by roadrunner Employee on Sep 9, 2014
Latest reply on Sep 10, 2014 by ABuda

 

We are working on a new thermocouple/RTD measurement device and we've chosen the ADuC7060 to experiment with. We encounter an issue when trying to use both the primary ADC and auxiliary ADC at the same time in continuous mode using interrupt. Here's what we do step by step:

 

1) Configure primary ADC by writing to register ADC0CON.
2) Configure auxiliary ADC by writing to register ADC1CON.
3) Enable ADC interrupt in register IRQEN by setting bit 0x400.
4) Enable the following ADC interrupt sources by setting bit 0 and 1 in register ADCMSKI: ADC0RDY_INTEN, ADC1RDY_INTEN

 

 

 

After that initial setup, we are able to get data inside of the ADC interrupt. What confuses us is that the primary ADC and auxiliary ADC each has its own interrupt source. So for example, when the auxiliary ADC completes a conversion and stores the converted value in the ADC1DAT register, BIT1 in the ADCSTA register will be set as well as the ADC1RDY_INTEN interrupt source will be triggered. In the datasheet, it says that "ADC does not update this [ADC1DAT] MMR if the ADC0 conversion result ready bit (ADCSTA[1]) is set. A read of this [ADC0DAT] MMR by the MCU clears all asserted ready flags (ADCSTA[1:0])." This can be found in the datasheet on page 50.

 

 

With that said, our issue is the following. Let's say as we handle the ADC1RDY_INTEN interrupt source, we have to read ADC0DAT after reading ADC1DAT to clear BIT0 and BIT1 of the ADCSTA register so we can continue to receive new sample in register ADC1DAT. But what if the primary ADC completes a conversion right before we read ADC0DAT? Does that mean that sample of data the the primary ADC just put in ADC0DAT will just go un-noticed (since we just cleared the status bits by readying ADC0DAT)?

Outcomes