This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
Is there any way to trigger the sampling of the ADC with a button press or similar interrupt? Right now I am using the ADC12_B_setupSamplingTimer method to get samples. However, I would like to only take a sample on a button press. Is there a method that gets a single sample?
Thanks
The ADC12SC bit in ADC12CTL0 triggers a conversion. Since you are writing ADC12_B_setupSamplingTimer, I assume you're using some kind of libraries? I have never worked with libraries, but I think you will have access to the registers of the processor, too? Even if not, isn't there any function like take_ADC_sample that takes one sample?
Dennis
But this function at least does not sound like taking a sample, it sounds more like configuring the ADC:
ADC12_B_setupSamplingTimer
Maybe I'm wrong. So let's wait for someone that uses the libraries, too. Sure there will be one that can help you with that. Can you post a link to the documentation?
Dennis
You can use the function ADC12_B_startConversion( ... ) for that. So something like this:
If( BUTTON_PRESS ) { ADC12_B_startConversion( ... ); // Make sure only one conversion is done per button press }
Look at page 22 of your document, chapter 5.3 Programming Example.
Dennis
Hi Daniel,
When you "startConversion", aren't you converting samples that you collected beforehand (at the frequency that setupSamplingTimer specifies)? I'm looking to take only 1 sample and convert that sample on each button press. Am i misunderstanding the use of setupSamplingTimer?
**Attention** This is a public forum