TEMPERATURE SENSOR. Revision Class. Instructor / Professor LICENSE

Similar documents
POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE

SEVEN SEGMENT DISPLAY LAB EXPERIMENT

ME 6405 Introduction to Mechatronics

Programming the Motorola MC68HC11 Microcontroller

Axiom Manufacturing. Users Manual. for PROJECT DEVELOPMENT BOARD AXM xiom anufacturing

Introduction to Microcontrollers

Cross Assembly and Program Development

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

CHAPTER 8. Solutions for Exercises

Using the stack and the stack pointer

Exam I Review February 2017

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

1. Memory Mapped Systems 2. Adding Unsigned Numbers

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral)

Lab 8: Debugging Embedded Devices and Software

Developing HC11 systems for RAM memory areas:

Sample Problem Set #1

It translates (converts) assembly language to machine code.

The Motorola 68HC11 Instruc5on Set

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

CodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Programming the CME11E9-EVBU, Keypad, and LCD

68HC12 Training Lab Student Exercise Book

Programming the CME11E9-EVBU, Keypad, and LCD

538 Lecture Notes Week 5

CMS-8GP32. A Motorola MC68HC908GP32 Microcontroller Board. xiom anufacturing

538 Lecture Notes Week 5

An ability to program a microcontroller to perform various tasks

Mark II Aiken Relay Calculator

Lab 7: Asynchronous Serial I/O

UNIVERSITY OF MANITOBA DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING. Term Test #2 Solution ECE 3610 MICROPROCESSING SYSTEMS

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012)

Coe538 Final Study Guide 2016 (Questions & Answers)

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

University of Florida EEL 4744 Fall 1998 Dr. Eric M. Schwartz

AN-HK-32. In-Circuit Programming of FLASH Memory in the MC68HC908GP32. nc... Freescale Semiconductor, I. PART 1 Introduction

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

ECE 3120 Computer Systems Arithmetic Programming

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

CMPEN 472 Sample EXAM II

Module 1-G. Marcos and Structured Programming

Lecture 9 Subroutines

Introduction to Microcontrollers II

538 Lecture Notes Week 3

EB301. Motorola Semiconductor Engineering Bulletin. Programming EEPROM on the MC68HC811E2 during Program Execution. Freescale Semiconductor, I

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

Lecture 6 Assembly Programming: Branch & Iteration

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Introduction to the 9S12 Microcontroller

INTERFACING THE ADS7870 AND THE MC68HC11E9 ANALOG TO MICROCOMPUTER MADE EASY

Chapter 4: Advanced Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

CME11E9-EVBU Development Board

Programming Book for 6809 Microprocessor Kit

ECE 367 -Experiment #1 Fall 2012

Exam 2 E2-1 Fall Name: Exam 2

Introduction to Microcontrollers II

Example Programs for 6502 Microprocessor Kit

EK307 Lab: Microcontrollers

Prototype Control Board for an Automated Bar (Robotic Bar Monkey)

Exam 2 E2-1 Fall Name: Exam 2

Teaching and Curriculum Development of Microprocessor Classes

EE319K Final Fall 2005 Solution C. (3) Question 1. (3) Question 2. short function(const short in){ return in+5; } const

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

AN1742. Programming the 68HC705J1A In-Circuit By Chris Falk CSG Product Engineering Austin, Texas. Introduction. Overview

ME 4447 / ME 6405: Introduction to Mechatronics

538 Lecture Notes Week 1

Timing Generation and Measurements

Outline. 2.8 Stack. 2.9 Subroutines

; export symbols ; export 'Entry' symbol. ; include derivative specific macros PORTA EQU $0000 PORTB EQU $0001 DDRA EQU $0002 DDRB EQU $0003

Lecture #4 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Monday, 25-Jan-2016

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6

0b) [2] Can you name 2 people form technical support services (stockroom)?

2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.

CS/ECE 5780/6780: Embedded System Design

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

EE 3170 Microcontroller Applications

Experiment 10 Fall 2012

Motorola HC11. Fun with Microcontrollers and Embedded Systems

EXPERIMENT 7 Please visit to learn all features of arduino before you start the experiments

ASSIGNMENT 4: INTRODUCTION TO THE 68HC11. Out: Monday, Sep 29, 2003 Due Monday, Oct 6, 2003

AN Kbyte Addressing with the M68HC11. Overview

Introduction to Microcontrollers III

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

APP-II PIC Development Kit by AWC

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

Test ROM V2 for MPU boards System 3, 4, 6, 7 and corresponding driver boards. Author: André Boot corrections in this document by coinop

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Interrupts and Resets

Assignment 2: 68HC11 Boot Lab

538 Lecture Notes Week 3

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE

Propeller Activity Board (#32910)

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access

Introduction to Microcontrollers III

REQUIRED MATERIALS Epiphany-DAQ board Wire Jumpers Switch LED Resistors Breadboard Multimeter (if needed)

Transcription:

CME-11E9 EVBU LAB EXPERIMENT TEMPERATURE SENSOR Revision 04.02.11 Class Instructor / Professor LICENSE You may use, copy, modify and distribute this document freely as long as you include this license and the Axiom Manufacturing copyright at the bottom of this page. You can download the latest version of this document from the Axiom website: www.axman.com 2003 Axiom Manufacturing Phone: 972-926-9303 2813 Industrial Lane - Garland, TX 75041 http://www.axman.com email: sales@axman.com

CONTENTS 1 REQUIREMENTS... 3 1.1 HARDWARE... 3 1.2 SOFTWARE... 3 2 GETTING STARTED... 4 3 LAB PROCEDURE... 4 3.1 DESCRIPTION... 4 3.2 DETAILED STEPS... 5 4 Temperature Program... 8 4.1 PROGRAM DESCRIPTION... 8 4.2 RUNNING THE PROGRAM... 8 4.3 TEMPERATURE PROGRAM SOURCE CODE... 9 5 QUIZ... 11 6 SCHEMATIC... 12 2

1 REQUIREMENTS 1.1 Hardware To complete this lab, the following hardware is required: Axiom CME-11E9 EVBU Development Kit PC running Windows OS Temperature Sensor Lab Kit which includes: o (1) LM34 o (3) Jumper wires 1.2 Software The CME11E9 EVBU board used in this experiment comes with all the software needed to complete this project. There are many additional utilities included on the boards support CD that can make developing your own projects easier. The CD contains example source code, documentation and experiments for all Axiom development boards. You can also download the latest versions of the software and documentation free from our web site at: www.axman.com. Also included is an integrated development environment, called AxIDE, for communicating with the board (via the serial port) and for reading and writing its flash memory. To complete this Lab, you should have this program installed on a PC running Microsoft Windows (95/98/2000/XP). NOTE: This lab does not teach you how to use the AxIDE terminal interface or the Buffalo Monitor program to modify memory and upload programs. It assumes you re already familiar with these procedures. Refer to your board manual for details on installing and using this software, including a tutorial for using AxIDE. CAUTION Devices used in this lab are static sensitive and easily damaged by mishandling. Use caution when installing wires and devices onto the board to prevent bending the leads. Experiments should be laid out in an orderly fashion. Start your lab time with the bench clean and free of metal objects and leave the lab area in a clean condition by picking up loose parts, wires and small objects. 3

2 GETTING STARTED This lab project will show you how to add a temperature sensor as an input device to the microcontroller on your Axiom development board. In this example, a temperature sensor with a Fahrenheit scale is used. A temperature sensor is a solid state device that changes its output voltage at a know rate whenever temperature changes. The device used in this lab has a linear output that follows the Fahrenheit scale. An analog port pin on the microcontroller will read this voltage and convert it to digital format. The temperature sensor is powered by +5 on the development board. The output voltage changes 10mv per degree Fahrenheit. So at room temperature of 72 degrees this sensor should output a voltage of 0.72 volts. Negative Fahrenheit temperature requires a negative supply voltage and is not supported in this lab. The accuracy of the sensor is normally very high and non-linearity very low. With output impedance low it is able to drive the A/D of the microcontroller. Being a low current device, self-heating is also very low. Temperature sensors are used in thermostat devices for controlling the temperature of a building. They re also used in appliances, machinery, cars and many other products to monitor temperature inside a product such as monitoring the temperature of the processor inside your computer. They come in Fahrenheit scale or Centigrade scale. These devices may be ordered in several temperature ranges, such as +32 to +212 degrees or 40 to +230 degrees. 3 LAB PROCEDURE This lab is arranged in a series of simple steps. Each step should be completed before moving on to the next one, which builds on prior ones. Repeat each step as many times as necessary to become familiar with it. You will find it easier to complete more complex experiments after mastering the simple ones. As an aid to keeping track of location it s a good idea to mark each step as it s completed, since the experiment will fail if anything is skipped. 3.1 Description This example uses PORTE, the analog port on the HC11 microcontroller. This port must be configured to continuously scan for analog input. With the analog channels 8-bit resolution and a +5 volt reference, the A/D has a resolution of.0194 volts per count. Analog channel 6 will be used to convert the analog voltage to digital format. You can see in the HC11 reference manual that A/D conversion results are read from location ADR3 (address $1033). Reading this result directly reflects the level on the analog pin. The analog channel is configured using the analog control registers OPTION ($1039) and ADCTL ($1030). Changing the temperature of the sensor will change the voltage applied to the analog channel. This change is converted to a Fahrenheit temperature. The temperature resolution is two degrees Fahrenheit. 4

3.2 Detailed Steps This section describes how to build the temperature sensor project and test it with the monitor running on the CME-11E9 EVBU. In the next section you ll see how to write a simple program to read the temperature sensor. NOTE: To complete these steps you must be familiar with modifying register contents on your board. For example, to read PORTE with the Buffalo monitor, type: MM 1033 into the terminal at the buffalo prompt and press <enter>. The value will display after the address. Type Help for more commands. You can use a different monitor or debugger if you prefer, such as the GNU GDB. 1. Verify power is NOT applied to the development board. 2. Install the temperature sensor on the breadboard area as shown in Figure 1. 3. Install the jumper wires on the board as follows: MCU PORT -----Breadboard GND----------------GND VCC----------------VCC PE6- ---------------TEMP 4. Install the MODA jumper on the EVBU board and remove jumpers MODB and MEM_EN, to configure the board for single chip operation, then apply power to the board. Register address used (see M68HC11E Technical Data manual for more information). OPTION = $1039 ADCTL = $1030 ADR3 = $1033 5. Using the debugger or monitor, write $80 to the OPTION register. This sets the ADPU bit high which turns the analog to digital converter on. Note: the buffalo monitor turns this on for you because it must be written in the first 64 cycles after reset. 6. Write $34 to ADCTRL register. This sets the A/D converter to continuous conversion on multiple channels. It also selects port E channels 4,5,6,7. The conversion results will be placed in ADR1 ADR4. 7. Read address ADR3. This is the result of the channel 6 A/D conversion of the voltage output from the temperature sensor. Record this 8-bit hex value as the ROOM Temperature. 8. Press the temperature sensor between your fingers for one minute then repeat step 7, but record this value as the HOT temperature. 9. Convert both ROOM and HOT readings to decimal values then multiply them by.0194. This will give you the voltage output of the temperature sensor. 10. By multiplying the voltage output by 100, one can convert the voltage to a Fahrenheit temperature reading. 5

11. Compare the ROOM temperature reading with the HOT reading. You should notice the HOT reading is higher than the ROOM temperature reading. This simple experiment demonstrates how easy a temperature sensor can be added to and processed by a microcontroller. By using one of the analog port pins on the HC11 the temperature is read and converted into a register. Any number of sensors can be added. The HC11 has 8 A/D channels for this purpose. Some circuit designs place an op-amp between the temperature sensor and microcontroller. By setting the op-amp gain to a value of two, the resolution of the microcontroller can be increased by two. This increases the resolution but reduces the temperature range. The temperature sensor is a precision integrated circuit but conversion errors add up. Errors can involve sensor precision, the 8-bit resolution or reference for the A/D on the microcontroller. The part comes in several packages. This lab used a thru-hole device but most production units use a surface mount device. They can be mounted directly onto a board, a motor or other device for monitoring temperature at its source. You can use a temperature sensor to control the temperature of a room. For example, using values produced by the A/D channel, a software program could toggle an I/O pin when the temperature moves out of a desired range. This I/O pin change could then turn a heater On or Off. Another application might be to control the speed of a fan based on the temperature reading. 6

Figure 1 VCC GND TEMP U1 7

4 Temperature Program The previous section described how to read temperature sensor manually using a debugger. While this method is useful for testing and experimenting, once the hardware is working you ll want to write software to automatically read the sensor. This section describes how to write such a program in assembly language. The source code is listed at the end of this section. Both source code and assembled executable for this example can also be downloaded from the Axiom web site: www.axman.com. If viewing this on your PC, you can copy and paste the source code below into a text editor (such as notepad) then save and assemble it using AxIDE. Refer to the owner s manual of your board for instructions on creating software and running programs for your development board. 4.1 Program Description The program first enables the analog converter for continuous conversion and multi channels. A delay routine is called before each conversion so the values can be read on the terminal. The conversion result is read from an 8-bit result register. This value is multiplied by 194, which is the.0194 mentioned earlier times 10,000. The result is divided by 100. The final value is the temperature in Fahrenheit in hex form. The value goes though a hex to decimal conversion routine that sends three decimal digits to the terminal. Finally, the program jumps back to the beginning and repeats until you press reset or remove power. 4.2 Running the Program 1. Upload the assembled program TEMP1A.S19 into the RAM on your board. This program starts at address $0100, which is internal memory on the CME-11E9 EVBU. The source code for this program is shown below. 2. Execute the program by typing call 100 in the terminal and pressing <enter>. 3. Verify a temperature reading is displayed on the terminal. 4. Change the temperature of the sensor and verify the temperature reading is also changing. 8

4.3 Temperature Program Source Code * Example: Fahrenheit Temperature Sensor - LM34 * Results: Displays the temperature in Fahrenheit * Note: Only 2 degrees resolution * Math: A = value read in hex * B = value of each step (.0194 * 10000 = 194) * Temperature = (A * 194)/100) * Analog Register Equates ADCTL: equ $1030 * Analog Control Register ADR3: equ $1033 * CH6 Analog Result OPTION: equ $1039 * Analog Enable Register OUTPUT: equ $FFAF * Buffalo output routine OUTRHLF: equ $FFB5 * Buffalo routine right nibble to AscII * Buffalo Routines OUTCRLF: equ $FFC4 * car/line feed OUT1BYT: equ $FFBB * Display Byte as hex TEMP: equ $01fe * temp storage * Setup the A/D converter org $0100 * program starts here ldaa #$80 * Turn A/D On staa OPTION ldaa #$36 * Select PE6, multi conversions staa ADCTL * Setup A/D * Display Results Loop2 jsr OUTCRLF * new line jsr Delay * read value & calculate temperature ldab #194 * Multi factor ldaa ADR3 * read 8-bit conversion mul * Multiple Unsigned D=Result ldx #100 * divide factor idiv pshx * save value puly * move to y bsr HexDec * convert hex to decimal ldx #TEMP * point to data std 0,x * save result std 0,x jsr OUT1BYT * send high byte jsr OUT1BYT * send low byte bra Loop2 * display next digit 9

* calculate Decimal Temperature * Input: Y should contain hex * Output: D should contain Decimal HexDec: clra clrb HexDecL: cmpy #$0000 beq HexDecE dey * decrement y adda #$01 * add one to A daa * Decimal adjust bcc HexDecK * skip over if carry not set addb #$01 * add one to B HexDecK: HexDecE: * exchange A & B pshb tab pula rts bra HexDecL * repeat until y = 0 * transfer a to b * get A Delay: DelayB: DelayA: ldab #$10 ldy #$FFFF dey bne DelayA decb bne DelayB rts 10

5 QUIZ Answer the following questions based on the example presented in this lab. 1. Select the start address of the example temperature program. A. $1000 B. $0100 C.$8000 D. $FFFE 2. What type temperature sensor is used in this lab? A. Centigrade B. Fahrenheit C. Thermal Couple D. Thermistor 3. How much does the sensor change per degree Fahrenheit? A. 10 MV B. 4888 MV C..01 MV D. 5 V 4. What type port is used in this lab? A. Digital B. Output C. Bi-Directional D. Analog 5. Which channel was chosen? A. 6 B. 5 C. 4 D. 3 6. What are the terms that best describe the temperature sensor? A. Linear B. Low Impedance C. Low Current D. A,B,C 7. The A/D is setup for? A. Continuous Conversion B. Stop Mode C. BDM Mode D. A, B, C 8. Which temperature below is out of range of this lab? A. 10 F B. 120 F C. 10 F D. 75 F 9. Select the answer that affects the reading? A. Hex/Decimal Conversion B. Stack Data C. Interrupts D. Reference 10. Choose the number of bytes in the temperature reading. A. 1 B. 2 C. 4 D. 8 BONUS QUESTION: What is the formula for conversion A/D value to degrees? Note: A = is the value read from the A/D converted to decimal. F = Fahrenheit A. F = (A*72)/5 B.F=(A*194)/100 C. F = (A*256)+4888 D.F = A-33 11

6 SCHEMATIC 12