ghead
Member level 2
HI, I'm using Mikroc pro for pic and PIC16F877A
I'm trying to pass a variable to a function like this
to this function
The function calls and returns and with the variable unchanged. Tested by setting a flag in the function and also just adding a number to "sum" in the function and returning with "sum".
Still the same result unchanged. Everything in function is declared except "sample".
Any ideas what am I missing here?
I'm trying to pass a variable to a function like this
Code C - [expand] 1 filter(average);
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Filter(unsigned int sample){ if (sum == 0) { bufferA[0] = sample; sum = sample * 4; } sum -= bufferA[oldest]; sum += sample; bufferA[oldest] = sample; oldest++; if (oldest >= 4) oldest = 0; return sum/4; }
Code C - [expand] 1 2 3 4 Filter(unsigned int sample){ sample = sample + 100; return sample; }
Any ideas what am I missing here?