Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
moving_average_on_avrs [2016/03/21 01:45] – [Practical Code] Note code size for the 2-value version. Traumflug | moving_average_on_avrs [2018/05/27 16:10] (current) – external edit (unknown user) | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Moving Average on AVRs ====== | ====== Moving Average on AVRs ====== | ||
- | One problem with the controlling strategy on the [[ISTAtrol]] is thermistor readings jittering by about 1%, which is quite a lot if we want to keep the reading ( = target temperature) in a similar | + | One problem with the controlling strategy on the [[ISTAtrol]] is thermistor readings jittering by about 1%, which is quite a lot if we want to keep the reading ( = target temperature) in a similarly |
There are solutions. Building better hardware is neither trivial nor free of cost, so the typical approach is to implement a **moving average algorithm**. | There are solutions. Building better hardware is neither trivial nor free of cost, so the typical approach is to implement a **moving average algorithm**. | ||
Line 41: | Line 41: | ||
static uint16_t temp_c = 0; // Reading used for controlling. | static uint16_t temp_c = 0; // Reading used for controlling. | ||
static uint16_t temp_temp = 0; // Reading directly from ADC. | static uint16_t temp_temp = 0; // Reading directly from ADC. | ||
- | #if TARGET_TEMPERATURE < 7000 // Avoid a compiler warning. | + | #if TARGET_TEMPERATURE < 7000 |
// We can expect thermistor readings to be always below 8192, so it always | // We can expect thermistor readings to be always below 8192, so it always | ||
// fits into 12 bits and we can always keep a multiplication by 8. | // fits into 12 bits and we can always keep a multiplication by 8. | ||
Line 62: | Line 62: | ||
</ | </ | ||
- | Code size on the ISTAtrol/ | + | Code size on the ISTAtrol/ |
moving_average_on_avrs.1458521102.txt.gz · Last modified: 2018/05/27 16:10 (external edit)