- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I am currently using ADCIN and I'm wondering if theres a way to "pause" the ADC for a certain time. Right now I'm setting pins that read from an external mux which sends back to my ADC in two different Channels. I have narrowed it down to most likely reading data too fast.
AMUX4_1_InputSelect(AMUX4_1_PORT0_3);
Set_Port0_1(0);
Set_Port2_7(0);
Read_ADC();
Let me know if you need more info
Solved! Go to Solution.
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To throw away n samples do a while loop capturing
n conversions and exit, last conversion the answer.
Something like this -
i = 3
while( i > 0 ) {
while(ADC12BIT_fIsDataAvailable() == 0); // Loop until value ready
iAtod_val = ADC12BIT_iClearFlagGetData (); // Get settled ADC result
i--;
}
The above will capture the 3'rd sample in iAtod_val;
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can start and stop an adc, but generally, unless there are
power considerations, I run the ADC continuously, and throw
away sample(s) if I need settling time.
The APIs are in the components datasheet to start and stop the
ADC. Read the fine print on the adc as you may need delay after startup,
for example flushing the decimator(s).
When you read ADC there is an API that indicates it has a new sample
ready. Normally one qualifies the read with this API indicating true, eg.
that a sample is ready. Look at the example project for the type ADC
you are using. Or the code sample at bottom of component datasheet.
Some people do a while() until the api indicates sample is ready, others
go do other things and come back to check if sample ready.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for answering,
my current way of doing things is
/* Start The ADC */
ADCINC_1_Start(ADCINC_1_HIGHPOWER);
ADCINC_1_GetSamples(0);
/* Infinite Loop */
while (1)
{
//other Code
while (ADCINC_1_fIsDataAvailable() == 0);
/* Read the ADC Result */
ADCINC_1_iClearFlagGetData();
}
How would I go about throwing away samples or if data was read too fast. would this have to deal with the Hz at which things are running? (Computer Science Major, Not tons of Electrical Experience).
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or I may be looking for something like an interrupt for 10ms for example after I switch channels and set ports which is before Reading the ADC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To throw away n samples do a while loop capturing
n conversions and exit, last conversion the answer.
Something like this -
i = 3
while( i > 0 ) {
while(ADC12BIT_fIsDataAvailable() == 0); // Loop until value ready
iAtod_val = ADC12BIT_iClearFlagGetData (); // Get settled ADC result
i--;
}
The above will capture the 3'rd sample in iAtod_val;
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit: This post was accidental
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the help with ADC setteling, My question expands from this and I decided to make a new post about how I should set up my frequencies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to have been of assistance.
Regards, Dana.