I posted this elsewhere by accident so apologies for the confusion..
Benj wrote:Hello Uli,
You can also do ADC averaging by taking multiple samples, adding the results together in a INT variable and then dividing by the number of samples. Remember not to let the INT variable accumulate more then 32767 or the values will start turning negative.
If the sample count is a factor of two then you can do a right shift instead of a divide to save a few program clock cycles.
eg "samples = samples >> 3" is the more efficient way of achieving "samples = samples / 8"
Could someone show a flowcode to do exactly this please.
I wish to read a temperature via adc1 (as int), assign the value to a variable 'Temp', run this in a loop 8 times @ 12ms per reading and output the average to another variable 'degc' for use by another part of the program.
The idea is that the reading used by the other parts of the program, will be devoid of jitter.........a sort of digital de-glitching.
Any V4 code examples please?