| ??? 10/12/03 17:27 Read: times |
#56557 - RE: Avaraging Responding to: ???'s previous message |
As you know from working with an list of numbers the average is the sum of all the numbers divided by the number of entries in the list. So for you can decide to set aside a place to store 20 samples and then total them and divide by 20.
There is another scheme that avoids having to divide by 20 should you choose to average 16 readings instead. After the summation of the 16 samples is complete you would simply ignore the low 4 bits of the sum and shift the sum right by four bits to get your average reading. The shift is same as divide by 16 but much faster than going through a divide operaton. It turns out that the ADC7109 is a 12 bit converter so adding together 16 twelve bit samples will not overflow a 16 bit summation so it would be perfectly logical to average with 16 samples. ------------------------------------- Now all issues aside regarding averaging. Temperature is a parameter that generally fits in the slooooooooooow time constant category. In other words it is generally a rather stable property relative to time it takes to do A/D conversions. If you are experiencing wildly erratic readings from your A/D converter then you should consider carefully why those readings are bouncing around. If it is circuit electrical noise, poorly filtered power connections, or EMI pickup that is causing the variation in readings it is quite likely that averaging is not really the proper solution to the problem. Averaging may be suitable if the noise pickup is predictable within some bounds of consideration, however the noise pickup could also have a statistical bias that ends up giving you the incorrect temperature reading. For example consider a case where the noise comes from the microcontroller setting up some circuitry in a program module that is going on right at the time of the A/D conversion. If the functions of the module were changed or if the processor was then placed into an IDLE mode during the conversion then the noise profile would change and the A/D readings would be correspondingly different. Another factor to consider is that if you have too much noise in your A/D system and you either do not want to or cannot remove the noise pickup problems then you would probably be better off just ignoring some of the LSB's of the A/D converter readings instead of going through an averaging process. For example try going to 9 bits and throw away the low 3 bits. Michael Karas |
| Topic | Author | Date |
| Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
| RE: Avaraging | 01/01/70 00:00 | |
RE: Avaraging | 01/01/70 00:00 |



