You are on page 1of 11
DIGITAL THERMOMETER BUILDING BLOCKS. ‘The building blocks are are now available to build a digital thermometer with a 0°C to 50°C range. + Temperature sensor - LM335 + Signal conditioning + AID (several methods) + LCD interface + Math + Decimal interface Offset and scaling are done by signal conditioning methods which provide a voltage range of 0 to 5 volts to the input of the A/D converter. sv _ 1L00mv AD Input c Voltage T ov : Temp-"C a The A/D counts up when it does a conversion. It's binary output represents temperature at 0.196 C*/ count. 0x00 =0°C 50S = 9,196 © OxFF = 49.98 °C 255counts count ‘We want to multiply the A/D conversion value by 0.196 *C /count. That can't be done but we can multiply by 196 and worry about the decimal point later. Here is the plan: 239 Measure Temperature ¥ Muttipy By 196 + Convert To Decimal ¥ Round Off To Nearest 1110 Degree ¥ Supress Leading Zeros [omen] Display Temperature ‘To multiply the data by 196, we need to find the hex equivalent. oxca {La 4 —~12x16 = 192 196 We will multiply the data by 0xC4 using the 8x8 unsigned multiply, 16-bit result routine described in the chapter on math routines. We already know how to convert a binary number to decimal. We will talk now about how to round off and suppress leading zeros. The decimal point is handled simply by displaying it in the correct position 240 ROUNDING OFF Once the temperature is in decimal form, it should be rounded off as the measurement is, accurate to within approximately 0.1 C". Example: 49.980 50.0 ‘We will round off the decimal result to the nearest tenth of a centigrade degree. A litle thought reveals that the rounding process can ripple back all the way to the most significant digit (see example above). ‘The round off routine rounds off the two least significant digits. It does not clean up trash left in their places because that information will not be displayed. 244

You might also like