Schmitt trigger:

A comparator with hysteresis. It has two trip points. This makes it immune to noise voltages, provided their peak-to-peak values are less than the hysteresis.