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 to perform a series of preliminary designs and tests on this microcontroller. This laboratory report presents one of these preliminary designs: the design of a temperature measurements and display system. The preliminary design presented in this laboratory report makes use of the HC11 analog-to-digital (A/D) converter and the serial subsystems. Figure 1. Temperature measurement and display system developed for the Motorolla 68HC11 microcontroller, which is attached to a universal evaluation board (EVBU). This section presents a description of the testing and design for this first preliminary design. This description is broken into sections: (1) connecting a temperature meausrement 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 includes a temperature measurement circuit and LEDs attached to Port B (the temperature measurement circuit is shown in Figure A-1 in Appendix A). ]. 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 means 0 degrees and 5 volts out means 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. 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 and 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 subroutine SETDISP controls the lighting of the LEDs connected to Port B based on the present value of TEMP. First, TEMP is loaded into accumulator A and compared with the value 20, the designated cut-off for low temperature.

Accumulator B is cleared to zero and represents the initial count value for the number of LEDs to turn on. Figure 2. Flowchart illustrating the determination of the number of Port B bits to enable for the LED display. Adding Serial Output to the HC11. This section presents the addition of three subroutines to the existing software developed in the previous section. The added subroutines, listed in Appendix D, are called OUTSCI, MESSOUT, and TEMPCHK. In addition to adding these three subroutines, the subroutine STARTUP, used in the previous section, was modified to initialize the serial subsystem of the HC11 so that it can communicate with the host PC at 9600 baud. TEMP is less than 20 degrees Fahrenheit. A flag variable called FLG ensures that the messages are not repeatedly sent for each entry into the very hot or very cold temperature regions. FLG is set to zero if TEMP is between 20 and 90 degrees and to one otherwise. While performing the preliminary design presented in this report, several mistakes and difficulties were encountered. The initial setup of the serial subsystem of the 68HC11 involved some troubleshooting.

We also had problems with sending the alarm messages more than one time because a flag variable was not set. The diagnosis and solutions to these problems are discussed in this section. Initially, the serial writes from the 68HC11 to the host PC did not work properly because the SP was not initialized and the data string was not terminated properly. With an incorrect SP, the function calls to the OUTSCI subroutine did not work as expected, and in fact caused the program to crash. By correctly loading the SP, the OUTSCI subroutine worked as expected. We also had a problem sending out messages using MESSOUT because we did not terminate the message strings correctly with the NULL zero. By adding the NULL zero to the end of the strings, the sending of messages worked as expected. A final problem was the output rate of the alarm messages. At first, we did not set a flag to indicate to the program that a message had already been sent to the PC. This failure caused messages to be continually sent to the PC terminal when the temperature was outside of the normal operating region.

"Are you looking for this answer? We can Help click Order Now"

UK BEST WRITING