# DSP applications for Hysterisis [closed]

How is hysteresis used for DSP?

## closed as too broad by The Photon, PeterJ, uint128_t, Andy aka, AsmyldofApr 6 '16 at 8:43

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

To keep the heater example of Ecnerwal, the code below turns on and off a heater. It keeps room temperature at 25ºC, with a hysteresis of 2 degrees. The objective of such a code is to reduce the number of calls to startupHeater() and shutdownHeater(), which would harm the heater if executed too often:

#define TEMPERATURE_LIMIT 25
#define TEMPERATURE_HYSTERESIS 2

void turnHeaterOnIfNeeded(int temperature) {
static boolean currentlyOn = false;

if (currentlyOn) {
if (temperature > TEMPERATURE_LIMIT + TEMPERATURE_HYSTERESIS) {
shutdownHeater();
currentlyOn = false;
}
} else {
if (temperature < TEMPERATURE_LIMIT - TEMPERATURE_HYSTERESIS) {
startupHeater();
currentlyOn = true;
}
}
}

void main() {
int temperature;
// ...
// ...

// Monitors the temperature:
temperature = measureTemperature();
turnHeaterOnIfNeeded(temperature);

// ...
// ...
}


Hysteresis is useful when you need to control a on/off process with an analog signal, if the turn on and turn off procedures have a cost. In particular if the analog signal has any kind of interference upon it.