@OP
Let us get clarified the meaning of 'Resolution' in the context of DS18B20 Temperature Sensor.
1. There is a programmable ADC (analog-to-digital converter) inside the DS18B20 sesnor. We can command the sensor to take a sample of 'input (how warm it is) signal' and convert it into 9-bit or 10-bit of 11-bit or 12-bit which is later on presented in 0C unit.
2. The following diagram (taken from the data sheets of the sensor) tells about the bit pattern of the ADC value.
![/cod
![dsTempReg.png|582x84](upload://nsFja9gYpz38F9YtmrB1g5v0oPB.png)
Figure-1:
**(1)** The Fig-1 says that the temperature value has two parts -- integer part and the fractional part. This is to say that the temperature is a floating point number (simply float). In Fig-1, the decimal point (the . symbol) is not shown/included; but, it is understood and it is located just after this: 2<sup>0</sup> and before this: 2<sup>-1</sup>. There is also a sign (S) bit which (when assumes Logic-High state) represents -ve temperature. (The float value is encoded in 2's complement form and not in binary32 format.)
**(2)** In Fig-1, we observe that there are upto 4 digits that we can include after the decimal point and these are: 2<sup>-1</sup>, 2<sup>-2</sup>, 2<sup>-3</sup>, and 2<sup>-4</sup> with respective positional values of: 0.5<sup>0</sup>C, 0.25<sup>0</sup>C, 0.125<sup>0</sup>C, and 0.0625<sup>0</sup>C.
**(3)** Now, the meanings of setting up 'Resolution' to 9-bit, 10-bit, 11-bit, and 12-bit' stand as:
**(a)** 9-bit:
1-bit for sign, 7-bit for integer part, and 1-bit for fractional part (1-digit after decimal point)
Temperature range: xxx.0<sup>0</sup>C to xxx.5<sup>0</sup>C in 0.5<sup>0</sup>C discrete step.
The command to present this float temperature (dsTemp) of 1-digit precision (number of digit after the decimal point) when the ADC Resolution is 9-bit.
Serial.print(temp, 1); //temp must be in float; 2nd argument 1 refers 1-digit precision
(Let us observe that there is subtle difference between precision and resolution.)
**(b)** 10-bit:
1-bit for sign, 7-bit for integer part, and 2-bit for fractional part (2-digit after decimal point)
Temperature range: xxx.00<sup>0</sup>C to xxx.75<sup>0</sup>C in 0.25<sup>0</sup>C discrete step.
The command to present this float temp:
Serial.print(dsTemp, 2);
**(c)** 11-bit:
1-bit for sign, 7-bit for integer part, and 3-bit for fractional part (3-digit after decimal point)
Temperature range: xxx.000<sup>0</sup>C to xxx.875<sup>0</sup>C in 0.125<sup>0</sup>C discrete step.
The command to present this float temp:
Serial.print(dsTemp, 3);
**(d)** 12-bit:
1-bit for sign, 7-bit for integer part, and 4-bit for fractional part (4-digit after decimal point)
Temperature range: xxx.0000<sup>0</sup>C to xxx.9375<sup>0</sup>C in 0.0625<sup>0</sup>C discrete step.
The command to present this float temp:
Serial.print(dsTemp, 4);
Hope that the issue is clear!
**The Test Codes:** (tested in UNO)
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 //DPin-2 of UNO at signal terminal
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float dsTemp;
void setup(void)
{
Serial.begin(9600);
sensors.begin(); //initialize One-Wire Sensor -- DS18B20
}
void loop(void)
{
sensors.setResolution(9); //before each measurement, set resolution
//sensors.setResolution(10);
//sensors.setResolution(11);
//sensors.setResolution(12);
sensors.requestTemperatures(); // Temp conversion command; waiting here until comversion is done
dsTemp = sensors.getTempCByIndex(0); //read temp data from Sensor #0 and convert to celsius float
Serial.println(dsTemp, 1); //1-digit precision
//Serial.println(dsTemp, 2); //2-digit precision
//Serial.println(dsTemp, 3); //3-digit precision
//Serial.println(dsTemp, 4); //4-digit precision
delay(1000); //sample temperature at 1-sec interval
}![/cod
![dsTempReg.png|582x84](upload://nsFja9gYpz38F9YtmrB1g5v0oPB.png)