H haowhaow New Member Feb 21, 2011 #21 be80be said: Haow all you need to to do is some thing like this If oldTemp less then newTemp by 10% count = 64 and loop 64 times and divide that for update of LCD If oldTemp less then newTemp by 20% count = 32 and loop 32 times and divide that for update of LCD If oldTemp less then newTemp by 30% count = 16 and loop 16 times and divide that for u date of LCD If oldTemp less then newTemp by 40% count = 8 and loop 8 times and divide that for update of LCD Some thing on that oder would work Click to expand... oh...im scratching my head....how i gonna put in together with my code??hehee
be80be said: Haow all you need to to do is some thing like this If oldTemp less then newTemp by 10% count = 64 and loop 64 times and divide that for update of LCD If oldTemp less then newTemp by 20% count = 32 and loop 32 times and divide that for update of LCD If oldTemp less then newTemp by 30% count = 16 and loop 16 times and divide that for u date of LCD If oldTemp less then newTemp by 40% count = 8 and loop 8 times and divide that for update of LCD Some thing on that oder would work Click to expand... oh...im scratching my head....how i gonna put in together with my code??hehee
ericgibbs Well-Known Member Most Helpful Member Feb 22, 2011 #22 hi, Using those increments is simply a case of the number of Right Shifts to be used to get the average of the sample size. eg: if new absolute value is different by 40% of the old value, use 8 samples to form the new average sum, then right shift this value by 3
hi, Using those increments is simply a case of the number of Right Shifts to be used to get the average of the sample size. eg: if new absolute value is different by 40% of the old value, use 8 samples to form the new average sum, then right shift this value by 3
H haowhaow New Member Feb 22, 2011 #23 ericgibbs said: hi, Using those increments is simply a case of the number of Right Shifts to be used to get the average of the sample size. eg: if new absolute value is different by 40% of the old value, use 8 samples to form the new average sum, then right shift this value by 3 Click to expand... im noob....im still dun get it....haizz....
ericgibbs said: hi, Using those increments is simply a case of the number of Right Shifts to be used to get the average of the sample size. eg: if new absolute value is different by 40% of the old value, use 8 samples to form the new average sum, then right shift this value by 3 Click to expand... im noob....im still dun get it....haizz....
be80be Well-Known Member Feb 22, 2011 #24 I'll see if I can find you some Hi-hech C code on averaging Some thing like this I didn't try it the coding may be wrong but I think it close Code: ADC_old=ADRESH; ADC_new=ADRESH; switch (ADC_new) ( case 10: ADC_new=ADRESH; if ADC_new + ADC_old << 8; i=8; ADC_old=ADC_new; ) for (i=i;>=0; i=-1 ADC_new=ADRESH+ADRESH; ) You'll need 4 or 5 case statements Last edited: Feb 22, 2011
I'll see if I can find you some Hi-hech C code on averaging Some thing like this I didn't try it the coding may be wrong but I think it close Code: ADC_old=ADRESH; ADC_new=ADRESH; switch (ADC_new) ( case 10: ADC_new=ADRESH; if ADC_new + ADC_old << 8; i=8; ADC_old=ADC_new; ) for (i=i;>=0; i=-1 ADC_new=ADRESH+ADRESH; ) You'll need 4 or 5 case statements