DS1821 Temperature Sensor over OneWire with Highest Resolution Calculation

How to program the sensor in the thermostat mode and back into a thermometer?