Sensor
The values from the ADC correlate linearly to the voltage input to the sigma delta converter. Figure 12 shows a range of measurements we made, along with a linear trend line and the corresponding equation.

FIGURE 12: ADC values versus voltage
The linear relationship between voltage and temperature (over a limited range) shown in Figure 8-5 combines with the relationship in Figure 8-13 to create a linear relationship directly between ADC value and temperature, as shown in Figure 8-14. The actual constant offset (98.151 in the figure) you’ll need varies from one sample of the probe to another; you’ll probably want to adjust it (and perhaps the variable coefficient too) to match the probe you use.We saw a variation of 5 to 10 degrees among probes.
The essential details you need from Figure 13 for software implementation are these:
1. The useful range of ADC values runs from 125 to 159.
2. The ADC value range corresponds to a temperature range of 211 to 240°F.
3. The equation T = 0.8945 * ADC + 98.151 converts ADC values to temperatures.

FIGURE 13: ADC values versus temperature
The Javelin Stamp only directly implements 16-bit integer arithmetic, however, so the software has to process these equations without floating-point support and without overflowing the 16- bit signed integers.
The ConvertToTemp routine both thresholds the ADC values, returning ±1 for out-of-range values, and computes the temperature for values in range. The computation multiplies by the numerator of the fraction 179/2 first, before the divide, to ensure there’s no loss of precision due to integer truncation after the divide.We derived 179/2 in this sequence:
1. The coefficient for the ADC samples is 0.89, derived from the equation T = 0.89*ADC + 98.
2. We converted 0.89 to 89/100 to make the calculation a sequence of integer operations.
3. Multiplying both factors by 2 keeps the ratio constant, but retains the most accuracy in the calculation by using all the bits available for the multiply. You can check this by noting that the maximum ADC sample is 159, so the largest possible multiplier without overflow is 32767/159 = 206.081, which rounds down to 206. The corresponding denominator would be 206/0.89, or 231.46, rounded to 231.
4. We wanted to maintain the integer temperature in hundredths of a degree (that is, multiplied by 100), and chose to incorporate the factor of 100 in the denominator of the factors. Dividing 231 by 100 with integer truncation creates an error of over 13 percent, so instead we chose the denominator to be 200/100 = 2. The corresponding numerator becomes 200 * 0.89 = 178.
5. Finally, the additive constant gets scaled by 100 to match the units we’re converting to, becoming 98.151 * 100 = 9815.
The ADC updates its measurement every 2.1 milliseconds, far faster than we sample in the controller application.