yes but it is there in that code but I don't know how to remove that error.
There is a 'return' statement but it doesn't specify any value.
yeah, I got it I just put return 0 now it's solved. thanks for the help guys.
FYI, removing compiler errors doesn't guarantee that a program will work correctly.
That is an incredibly foolish repair. If you don't need a return value from a function, declare it as void.
But, I suspect you are programming by trial and error. That will never work for a program of this complexity.
oho okay then how can I solve should i remove return?
I already told you in the last post.
Do you mean return void...? I don't understand.
I just got to a computer for a look at the code - it's incredibly foolish code, using inappropriate datatypes (double for Boolean is one example)
Have a look here, especially this:
yes, but I am a beginner and I am trying to learn the codes. and also when i use this i am not getting the vpp for square waves.
thank you.
I can't see where you're updating the maxValue and minValue variables.
The code is a bit of a tough read.
Is it not a "user-defined" C function?
It is not a stand-alone function; it will do something if the formal parameters are received from the calling program.
this may be the max and min value update
Find max peak and min peak to measure peak to peak voltage
//-----------------------------------------------------------------------------
if (lastSample < sampleV) { //trace is going up
if (Chng < 0 && onUp < stayCount) //If minimum was detected we are going to check there is not a false minimum
oldChng = Chng;
if (oldChng < 0 && onUp> stayCount) { //if we found a minimum and after stayCount samples the trace is going up then recorded the minimum and reset
sumMin += min;
min = 1023;
minCount++;
oldChng = 0;
onUp = 0;
onLow = 0;
}
lastSample = sampleV;
Chng = 1;
onUp++;
if (max < sampleV)
max = sampleV; // get max value
}
else if (lastSample > sampleV) { //trace is going down
if (Chng > 0 && onLow < stayCount) //If maximum was detected we are going to check there is not a false maximum
oldChng = Chng;
if (oldChng > 0 && onLow > stayCount) { //if we found a maximum and after stayCount samples the trace is going down then recorded the maximum and reset
sumMax += max;
max = 0;
maxCount++;
oldChng = 0;
onLow = 0;
onUp = 0;
}
lastSample = sampleV;
Chng = -1;
onLow++;
if (min > sampleV)
min = sampleV; //get min value
}
So why have you got maxValue and minValue variables if you don't use them?
What is the int variable i used for?
(Maybe they're anti-plagiarism measures...)
It's time to ask, where did this code come from? Did you write it from scratch, or attempt to modify someone else's code?
#post 2 i have got the code
Then just look around for some better code. Or, better, learn how to code and write it from scratch.
How to take min and Max values, can anyone give me the code to calculate Vpp. I tried so much but still not getting...