2018-11-08 02:51 AM
Dear Member,
I want to get a peak value from ADC,
How can I get it on the code ?
Loop and array ?
Any references ?
Kind regards,
A
2018-11-08 02:56 AM
Not sure what you mean.
The ADC has only one result register, ergo only one result. Maximal value is 2^12-1.
If you speak about values collected in an array or list, this amounts to a simple comparision in a loop.
2018-11-08 03:25 AM
Yes I speak about values collected in array or list,
I want to take maximum value to each of the cycle
I have 100Hz signal of voltage and I want to sampe 10 times and find the maximum value of them,
Any ideas or example ? thanks
2018-11-08 03:39 AM
> I have 100Hz signal of voltage and I want to sampe 10 times and find the maximum value of them,...
The 100Hz are irrelvant here.
Do you honestly have no idea of how to find the greatest value in a list/array of 10 ???
I would recommend a good C programming language tutorial. Such things are the bread-and-butter business of an embedded developer.
2018-11-08 04:40 AM
I'm thinking that looping ADC read and keep the result in one array variable then find maximum one,
Find maximum in loop ?
2018-11-08 05:14 AM
There maybe some interference with ADC results so you better take several at a time and average. After that you just compare your current result to the maximum and keep bigger.
2018-11-08 12:41 PM
My thinking :
for i=0;i<=10;i++
ADCResult[i];
ADCMax=ADCResult[i];
if ADCMax<ADCResult[i]
ADCMax=ADCResult[i];
Do you reckon ?