PROJECT 18 – Digital Thermometer with Centigrade/ Fahrenheit Output
Function
This project is similar to Project I7, but in addition the outputs can display the temperature in both Centigrade (oC) and Fahrenheit (oF). An SPDT switch is connected to bit 3 of port 3 and the output of this switch is normally held at logic high with a pull-up resistor. In this state the output display is in oC. When the switch is pressed, the display changes toshow the temperature in oF. The rest of the project is the same as Project I7, i.e. the temperature is measured with a DSI620 type thermometer IC and the output is displayed on three TIL3II type alphanumeric displays.
Circuit Diagram
The block diagram of this project is shown in Fig. 5.5. The circuit diagram is similar to the circuit of Project I7 with the addition of an SPDT switch to bit 3 of port 3. The temperature is sensed by the DSI620 thermometer IC and the output is displayed either in oC or in oF based upon the state of the SPDT switch. The full circuit diagram is shown in Fig. 5.6.
Program Description
The program is the same as the one in Project I7 except that the state of the SPDT switch is monitored and when the switch is pressed, the temperature is converted from oC to oF and then displayed accordingly. Negative tempera- tures are displayed by inserting the leading letter ‘E’.
Program Listing
The full program listing of this project is shown in Fig. 5.7. Only the parts which are different from Project I7 are described here. Variable mode is assigned to bit 3 of port 3. The value of mode is checked in function display_temperature. If mode is zero(i.e. in Fahrenheit mode), the temperature is converted to oF by multiplying by I.8 and adding 32. The final temperature is then displayed as in Project I7.
Components Required
In addition to the standard components required by the microcontroller, the following components will be required for this project: