The HC11. Alexandra Carey & Richard Hughey. University of California, School of Engineering Santa Cruz, CA 95064

Similar documents
Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.


Design of Embedded Systems Using 68HC12/11 Microcontrollers

Microcontrollers. Microcontroller

1. Internal Architecture of 8085 Microprocessor

Input/Output Modes Chapter 8

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Microprocessors and Microcontrollers Prof. Santanu Chattopadhyay Department of E & EC Engineering Indian Institute of Technology, Kharagpur

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

Microprocessors/Microcontrollers

Microcontroller & Interfacing

Lab 9: On-Board Time Generation and Interrupts

Chapter 7 Central Processor Unit (S08CPUV2)

8051 Microcontroller Interrupts

Introduction to Microprocessor

SYSTEM FUNCTIONAL TEST TEST PROGRAM 1 ADDRESS INSTRUCTION ADDRESS INSTRUCTION BINARY DESCRIPTION DB INPUT

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

Job Posting (Aug. 19) ECE 425. ARM7 Block Diagram. ARM Programming. Assembly Language Programming. ARM Architecture 9/7/2017. Microprocessor Systems

EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1

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

2. List the five interrupt pins available in INTR, TRAP, RST 7.5, RST 6.5, RST 5.5.

Laboratory 10. Programming a PIC Microcontroller - Part II

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

Microprocessor Architecture

User. Application program. Interfaces. Operating system. Hardware

Basics of Microprocessor

Getting Started with the HCS12 IDE

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

8086 INTERNAL ARCHITECTURE

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Interrupt is a process where an external device can get the attention of the microprocessor. Interrupts can be classified into two types:

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

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

PROGRAMMING AND CUSTOMIZING

Microcontrollers and the Freescale/Motorola HC11

The World of Microcontrollers: A Beginning Guide to the HC11 Microkit

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

8051 Microcontrollers

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMMUNICATION ENGINEERING REG 2008 TWO MARKS QUESTION AND ANSWERS

Interrupts. by Rahul Patel, Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

Week 6: Processor Components

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

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

8085 Interrupts. Lecturer, CSE, AUST

8/26/2010. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to Three Units of 8085

538 Lecture Notes Week 5

Microcomputer Architecture and Programming

Architecture of 8085 microprocessor

12-Dec-11. Gursharan Singh Maninder Kaur. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to 8085

Chapter 1: Basics of Microprocessor [08 M]

Laboratory Exercise 7

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

538 Lecture Notes Week 5

8086 Interrupts and Interrupt Responses:

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

GUJARAT TECHNOLOGICAL UNIVERSITY

1. Internal Architecture of 8085 Microprocessor

MICROPROCESSOR MICROPROCESSOR. From the above description, we can draw the following block diagram to represent a microprocessor based system: Output

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

MICROPROCESSOR B.Tech. th ECE

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Chapter 2 Instruction Set Architecture

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

538 Lecture Notes Week 1

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

CC411: Introduction To Microprocessors

1. Internal Architecture of 8085 Microprocessor

Mobile Operating Systems Lesson 04 PalmOS Part 2


CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

Intel 8086 MICROPROCESSOR. By Y V S Murthy

MOXSYN. General Description. Features. Symbol

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Pin Description, Status & Control Signals of 8085 Microprocessor

EECE 340 Introduction to Microprocessors w/lab Section A. Term Project Parking Visitor Counter

Four Categories Of 8085 Instructions That >>>CLICK HERE<<<

Chapter 1 Computer System Overview

Introduction to Microcontrollers

Microprocessors B (17.384) Spring Lecture Outline

QUESTION BANK. EE 6502 / Microprocessor and Microcontroller. Unit I Processor. PART-A (2-Marks)

Practical Course File For

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes.

3. The MC6802 MICROPROCESSOR

C Language Programming, Interrupts and Timer Hardware

EKT222 Miroprocessor Systems Lab 5

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip.

EE458 - Embedded Systems Exceptions and Interrupts

Programming the Motorola MC68HC11 Microcontroller

BASICS OF THE RENESAS SYNERGY TM

A First Look at Microprocessors

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

ECE 372 Microcontroller Design Parallel IO Ports - Interrupts. ECE 372 Microcontroller Design Parallel IO Ports - Interrupts

Interrupt-Driven Input/Output

V8-uRISC 8-bit RISC Microprocessor AllianceCORE Facts Core Specifics VAutomation, Inc. Supported Devices/Resources Remaining I/O CLBs

Lab 6 Using PicoBlaze. Fast Sorting.

Transcription:

Abstract A microcontroller is a microprocessor that controls everyday appliances such as microwaves and wristwatches. The microkits used by computer engineering classes use a Motorola HC11 microcontroller for all of the processing. The HC11 microkits have 8 input switches, a single interrupt request button (IRQ), 8 output LEDs, and a two-line liquid crystal display (LCD). The HC11 kit also has a pulse accumulator, or a counter, which is incremented once per clock cycle. I wrote a program for the HC11 that computes two random numbers and adds or subtracts them, depending on the user input. The procedure I used to compute a random number is simply this: When an external interrupt is encountered (the interrupt request (IRQ) button is depressed), take the remainder of the pulse accumulator (counter) divided by 9. The result of this operation gives a number between 0 and 9. Do this twice, adding or subtracting the values and displaying the result in hexadecimal format to the LCD. Simultaneously with the addition or subtraction, step the lights once in their light pattern, flipping all of the on lights to off and vice versa. This series of instructions makes use of the pulse accumulator as well as internal interrupts (generated by my program) and external interrupts (the IRQ button). The pulse accumulator initializations were written by Stephen Petersen.

The HC11 Alexandra Carey & Richard Hughey University of California, School of Engineering Santa Cruz, CA 95064

Introduction The HC11A8 is the first microprocessor in a line of HC11 processors by Motorola. These microkits are used in a few computer engineering courses at UCSC. The first of these courses is computer engineering 12c, introduction to computer organization. In the second half of this class, the students are asked to program in HC11 assembly language, which gives students an abstract view of the way a computer works. Initially, the program (a hexadecimal adder and subtractor) prints a welcome message and enters an infinite loop waiting for an interrupt. The interrupt is received in the form of the IRQ pin by the switches, and will begin the program. Before depressing this button, select a function by entering the binary pattern string on the switches. The valid inputs are listed in Figure 1. After selecting the functionality and depressing the IRQ, the first thing the user will notice is that the light emitting diodes (LEDs) are flashing with a pattern each light alternates from on to off. Next, the user may notice the LCD has displayed the first problem. There is a short delay before the answer is produced. The user does not need to input the answer, only to think of it or say it out loud. An example of the output is in Figure 3. The program then waits indefinitely, flashing the lights, until the IRQ is depressed again, and then performs the requested action.

Materials and Methods - Algorithm Initialization Download and execute program. The program is now known as the resident program. Initialize Registers. See Figure 2 for more information on the registers available to the user. Store the address of the IRQ interrupt service routine (ISR) by storing the address of the ISR to the address of the IRQ pin on the interrupt table. The ISR is simply a procedure that will handle the interrupt that is, when an interrupt occurs, it will be sent to this location in memory and will execute the code there until told to go back. The interrupt table holds information about all sorts of different interrupts that could occur while executing a resident program. Clear the LCD and display welcome messages.

Main loop Enter the main loop. Here, the light pattern flips all ones to zeros and all zeros to ones and the user input (coming from the SWITCHES) locks by storing the bit pattern to memory. The bit pattern is then checked against one of three input values: 0000 0000, 0000 0001, and 0000 0011 for add, subtract, and restart. All other values are regarded as the last operation processed. Perform some preliminary steps before computation. If the user wishes to add, then store a plus sign (+) to a variable in memory for later use. If subtracting is selected, store a minus sign (-). Restarting will send the program back to the point of displaying initial welcome messages to the LCD. Reset the user input and resume operation from the main loop.

Interrupt processing When the IRQ is depressed, immediately rush to the ISR for the IRQ. Do not even wait to finish the instruction in execution! On the way there, save all of the important information (stored in the registers and accumulator) onto the system stack. From within the interrupt, compute the random numbers, add or subtract them, and display the result. Next, clear the user input and return, restoring all saved registers.

Calculation and Display Generate the pseudorandom numbers by finding the remainder of division of the pulse accumulator by 9. This gives a value between 0 and 8. If the two random numbers are not in the 0-9 range, add hexadecimal 37 to boost them up to the uppercase hex values on the ASCII table. Else add #$30 (hexadecimal) to make them ASCII numerals. Sort in descending order. This will guarantee that there will be no negatives! Print the numbers, displaying the sign (+/-) between them. Print the equal sign. Adding or subtracting the two values usually will give a hexadecimal result between 0 and F. Convert the result to a printable character by adding the appropriate hexadecimal values. Create a short delay (thinking time!) and display the result in the same manner. Return from interrupt to Main loop, restoring variables from stack.

Results Unanticipated Features (Bugs) 1. Lights flash slower when switches are 0000 0011. This is because the restart routine will display welcome messages to the LCD. Each message has a short delay, thus slowing the entire procedure. 2. As soon as value on SWITCHES changes to 0000 0011, the program goes to restart mode, not waiting for the IRQ to be depressed. 3. Lights do not flash while displaying answer. This is because the answer is calculated and displayed from within the interrupt, and the light flashing routine is in the main program. 4. Interrupts are not debounced. That is, one press of the IRQ may spawn several nested interrupts. The consequence is a number of result digits are displayed onto the screen. 5. Only one digit arithmetic is supported. 6. Result of addition of 8+8=G, which is not a hexadecimal value.

Future Implementations 1. Change flashing lights routine to use pulse accumulator instead of the more archaic WAIT function. This will fix both the lights not flashing while the answer is displayed and the slow flashing while in reset mode. 2. Multiple digit answer support!

Dictionary HC11 The HC11 is a one of a line of microcontrollers produced by Motorola. The one in this demonstration is the HC11A8. Hexadecimal Base 16. The hexadecimal digits are 0-9,A-F. Interrupt Any asynchronous signal to the processor that tells it that something important is happening. An example of an interrupt is the IRQ button being depressed. Interrupt Table This is a table that holds information about all sorts of different interrupts that could occur while executing a resident program. IRQ Interrupt ReQuest. Most commonly referring to the INTERRUPT pin on the HC11 board, to the left of the switches. ISR Interrupt Service Routine. This is the interrupt procedure that is called when the specified interrupt occurs. In this case, ISR refers to the procedure to handle the IRQ. LCD Liquid Crystal Display. This, the small screen, is the main source of output on the HC11. LEDs Light Emitting Diodes. A secondary source of output of the HC11. There are 8 active-low LEDs onboard the HC11. This means that when a value 0 is passed to the LED, the light is on. Inversely, when a value 1 is passed, the light is off. LEDs is also a place in memory, the physical address of the LEDs.

Microcontroller A usually simple microprocessor used to control everyday appliances. Pseudorandom number As random as the kit will get! Because the numbers are based off of a system clock, the randomness will always be calculated (and therefore not really random). Pulse Accumulator An accumulator that is incremented every 4.096ms by the system clock. Resident Program The user program that has most recently been downloaded onto the microkit. SWITCHES A series of input switches. Together, these produce 8 bits of binary input. When a switch is up, or towards the LEDs, then the value it produces is 1. Otherwise the switch is down and the value is 0. SWITCHES is usually uppercase because it also refers to a place in memory, the physical address of the switches. System Stack A stack is an important abstract data type based on the principle of placing information on top of other information, thus forming a stack. The last information on the stack will be the first to be retrieved, and vice-versa. A stack pointer points to the top free location on the stack, so the user will always know where his or her data is relative to the stack pointer. The HC11 provides a handy implementation of the stack by allowing the user to modify the system stack. A benefit of using the system stack over a user-defined stack is that the system stack already exists and does not need to be

allocated by the user. HC11 stack instructions are also very user-friendly in that they increment and decrement the stack pointer for the user.

References 1. Motorola. M69HC11 Reference Manual. Motorola Inc., 1991. 2. Petersen, Stephen. http://www.cse.ucsc.edu/classes/ cmpe012/fall99/pacc_ex.asm. 1999. Acknowledgements 1. Guilford, Jason. Debugging. 2. McIntire, Cliffton. Debugging.

Figure 1. SWITCHES input. 0000 0000 add 0000 0001 subtract 0000 0011 restart program Make the switches portray these bit patterns to perform the desired function. Figure 2. HC11 Registers. A B [======== ========] D [=================] X [=================] Y [=================] Accumulators A and B are the top and bottom halves of D. X and Y are index registers (normally used for addresses and simple 16-bit computations).

Figure 3. Example output. - HEX Calc INTR - continue - [press interrupt] - Quick! 6+4=A INTR - continue - [press interrupt to loop] - Quick! 6+4= INTR - continue - [think here]