ADC simultaneous read/write

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Mrinal
Level 4
Level 4
First solution authored 50 replies posted 25 replies posted

What happens if the CPU tries to read ADC data while the ADC is writing the results to the channel register? Is there a possibility of error that needs to be handled by the programmer or does the ADC_GetResult16() function handle it itself?

   

Thank you

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is an API for checking for a conversion ready ADC_IsEndConversion() which you should use. The ADC results are buffered, so there is no interference when reading them.

   

Alternatively you can connect an interrupt to the eoc (End Of Conversion) pin and read the results in the interrupt handler.

   

 

   

Bob

0 Likes
Mrinal
Level 4
Level 4
First solution authored 50 replies posted 25 replies posted

Thanks for the reply!

   

Although I am using the EOC interrupt to read the results, I just wanted to confirm whether there is a possibility of  data crash in case of NOT using the EOC interrupt. But as you said, the ADC output is buffered which eliminates any such possibility. Solves my question perfectly.

   

Thanks again.

0 Likes