>
Introduction
>
This semester, our design team is creating a design using the Motorolla
68HC11 microcontroller, referred to here as the HC11. Before beginning this design project, we are performing a series of preliminary designs and tests on this microcontroller. This report presents one of these preliminary designs: the design of a temperature measurement and display system.
This preliminary design makes use of the HC11 analog-to-digital (A/D) converter and the serial subsystems. These components are shown in Figure 1. The hardware added for the preliminary design includes a temperature
measurement circuit connected to one of the HC11 A/D input pins on Port E,
and light emitting diodes (LEDs) connected to each pin of Port B. These LEDs act as temperature indicators. Additionally, the design includes a connection between the HC11 and a remote personal computer (PC) using an RS-232 connection. This connection serves to send messages to the PC regarding temperature. An assembly software program developed for this design performs various functions for using the added hardware.
This report breaks down the preliminary design into two sections. In the first section, separate hardware and software designs are presented. The hardware designed for section one includes the temperature measurement circuit and the connection of LEDs to Port B. The software designed for section one initializes the A/D converter and serial subsystems, controls the measurement and storage of the temperature in a RAM variable called TEMP, and controls the display of temperature on the LED outputs.
The second section of the report presents the connection of the HC11 to a remote PC terminal through an RS-232 connection. After adding the software required to initialize the serial subsystem, subroutines, which are added to the software program developed for the report's first section, allow the HC11 to send a message to the PC if the
measured temperature falls below 20 degrees or above 90 degrees.

Figure 1. Temperature measurement and display system developed for the Motorolla 68HC11 microcontroller, which is attached to a universal evaluation board (EVBU).
>
>
Discussion of Design and Testing
>
This section presents a description of the design for this first preliminary design. This description is broken into sections: (1) connecting a temperature measurement circuit to the HC11 microcontroller; and (2) adding a serial output to the HC11 microcontroller.
>
Connecting a Temperature Measurement Circuit to the HC11. Connecting a temperature measurement circuit to the HC11 microcontroller involved both hardware and software. Hardware was added to control the measurement and display of the temperature. This hardware included a temperature measurement circuit and LEDs attached to Port B (the temperature measurement circuit is shown in Figure A-1 in Appendix A). The circuit was designed according to the specifications obtained from the Computer Engineering Laboratories website for ECPE 4535 [Lineberry, 1998]. Within the circuit is an LM3911 temperature controller integrated circuit (IC), the output of which is connected into a non-inverting opamp. The output of the opamp connects to the HC11 A/D input pin E2 through a 1000-ohm resistor. The circuitry is scaled so that 0 volts out corresponds to 0 degrees and 5 volts out corresponds to 110 degrees.
To each of the output pins of Port B, LEDs are connected using a 74HC244 buffer IC and 330-ohm current limiting resistors as shown in Appendix A. The LEDs are located in the breadboard area of the trainer kits.
To control this added hardware, the HC11 was programmed following the pseudo code, flow chart, and program listing given in Appendices B, C, and D, respectively. The program shown in Appendix D consists of three subroutines that are called from MAIN. The three subroutines are named STARTUP, GETTEMP, and SETDISP.
The STARTUP subroutine is used to enable the A/D converter subsystem, which
is connected to Port E. First the A/D is powered up by setting bit 7 of the OPTION register. After a 100 microsecond delay, the control word $22 is written to the ADCTL
register to start continuous, single-scan conversions on Port E pin E2.
The subroutine GETTEMP is used to input and scale the analog voltage from the temperature sensor circuit. The register ADR3 holds the result of the A/D conversions. This result is loaded into accumulator A and then multiplied by a scale factor contained in accumulator B by using the MUL instruction. The result contained in accumulator A is then right shifted once giving the temperature in degrees Fahrenheit, which is then stored in the RAM variable TEMP. The equation for finding TEMP is shown in (1).