- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.