The Making of a Microprocessor but the Mindset Was Still That of Counting, Just at a Faster Pace
Total Page:16
File Type:pdf, Size:1020Kb
MicroprocessorMicroprocessor DesignDesign MadeMade EasyEasy Using the MC68HC11 Raj Shah President Advanced Microcomputer Systems, Inc. Pompano Beach, Florida Educational Division Acknowledgments ACKNOWLEDGMENTS “Microprocessor Design Made easy Using the MC68HC11” was designed and developed through the talents and energies of many hard working and dedicated individuals. The concept of using EZ-MICRO Tutor Board and EZ-MICRO Manager software along with this workbook in the schools has been well accepted by several community colleges as well as universities. Library of Congress Catalog-in-Publication Data Microprocessor Design Made Easy Using the MC68HC11 ISBN 0-9642962-4-1 Third Edition March, 2000 Fourth Edition January, 2002 Microprocessor Design Made easy Using the MC68HC11 Copyright © 200, 2001, 2002 by Advanced Microcomputer Systems Inc 1460 SW 3rd Street, Pompano Beach, FL 33069 Phone: (954) 784-0900 • Fax: (954) 784-0904 E-Mail: [email protected] Web: www.advancedmsinc.com All rights reserved. Printed in the United States of America. EZ-COURSEWARE Table of Contents 7DEOHRI&RQWHQWV Lesson 1 Introduction to Microprocessors Lesson 2 MC68HC11 Architecture and Addressing Modes Lesson 3 Programming the MC68HC11 Lesson 4 Using the EZ-MICRO Tutor Software Lesson 5 Software Interface to EZ-MICRO CPU-11 Lesson 6 Introduction to Programming Lesson 7 Introduction to C Programming Lesson 8 HC11 Technical Information Lesson 9 Interfacing Input/Output and Timer Devices Lesson 10 Serial Input/Output Lesson 11 Analog to Digital and Digital to Analog Conversion Lesson 12 Assembler Manual Lesson 13 Monitor Command Lesson 14 6811 Commands by Subject Appendix: A) References B) Specfications For Liquid Crystal Display Module C) LCD Driver D) MC68HC711E9 Technical Summary EZ-COURSEWARE Table of Contents EZ-COURSEWARE Introduction Introduction to Microprocessors and the Microprocessor System Design Process When you finish this lesson, you will know: 1. The history and evolution of the microprocessor. 2. The difference between 8-bit, 16-bit, and 32-bit microprocessors. 3. The different types of microprocessors available and their features. 4. The applications of each type of microprocessor. 5. The process of designing a microprocessor-controlled system. EZ-COURSEWARE 1-1 Introduction This EZ-COURSEWARE manual describes microprocessors and the microprocessor-system design process. It’s written for students studying single-chip microcomputers and microcontrollers for use in consumer products, manufacturing equipment, and laboratory instrumentation. Basically, a microprocessor is a single integrated circuit, often containing millions of transistors, that serves as the “brains” of a larger system, such as a personal computer. The single-chip microprocessor is also an ideal component for controlling mechanical and electrical devices, like a VCR or microwave oven. When this chip controls a specific product it’s called a microcontroller. This hands-on course focuses on the microcontroller aspect of the industry. Most of us already use products with microcontrollers embedded in them without even knowing it. Microcontrollers touch almost every facet of daily life and provide sophisticated features to consumer products at low cost. The following is a short list of some common products that use microcontroller computers. Audio equipment. Most CD players have electronic control buttons, digital displays, and automatic track selection and sequencing — all run by a microcontroller. Automobiles. Virtually every car in production today uses a microcontroller to control the delivery of fuel and adjust the spark timing for the engine. Microcontrollers can also be found in automatic transmissions, anti-lock brakes, and dashboard gauges. HVAC controllers. You probably know them better as thermostats, the wall devices that regulate the temperature of our homes and workplace. Unlike the bi-metal devices of old, today’s smart heating and air conditioning controllers have a microcontroller for a brain. Microwave ovens. Many microwave ovens can be programmed for various cooking times and power levels. Some even have sensors that automatically sense the food’s temperature and change the program accordingly. A microcontroller controls these and other functions. Security systems. If it weren’t for the microcontroller, which is able to detect motion and verify passwords, personal and building security would still be stuck in the world of locks and deadbolts. Video equipment. Undoubtedly the biggest consumer of single-chip microcontrollers is the video industry, which includes TVs and VCRs. Think about it. How else could you remotely change channels or program a VCR to record “Star Trek Voyager” weekly without something as smart as a microcontroller? From Fingers to Transistors The microcontroller that you will study in this guide is the MC68HC11 (also known as the 68HC11) from Motorola. Before we start, though, a little history is in order so that you know how the microcontroller came into existence. All microprocessors and microcontrollers are digital devices, in that they use numbers to direct and control their actions — as opposed to analog devices, which use quantities like weights and 1-2 EZ-COURSEWARE Introduction measures for their data input. For example, a VCR has a microcontroller for its brain, whereas a toaster usually has an analog bi-metal sensor (its “brain”) that senses the amount of moisture in the bread and (hopefully) pops up the toast before it burns. The first digital computer was “invented” when early humans realized that they could count sheep or bushels of corn using fingers (digits). Since that time, inventors have constantly sought better, faster, and cheaper ways to count and tally. The earliest known computing instrument is the abacus, a simple adding machine composed of beads strung on parallel wires in a rectangular frame, that’s used simply as a memory aid by a person making mental calculations. In contrast, adding machines, electronic calculators, and computers make physical calculations without the need for human reasoning. Blaise Pascal is widely credited with building the first "digital calculating machine" in 1642 as a way to help his father, who was a tax collector. His machine could add up numbers entered by means of dials. In 1671, Gottfried Wilhelm von Leibniz improved on the design by introducing a special "stepped gear" mechanism, which let the adding machine do multiplication, too. However, the prototypes built by Leibniz and Pascal weren’t widely used but remained curiosities until more than a century later, when in 1820, Thomas of Colmar (Charles Xavier Thomas) developed the first commercially successful mechanical calculator that could add, subtract, multiply, and divide. At about the same time (1812), Charles Babbage, a professor of mathematics at Cambridge University, England, advanced the concept of a “difference engine:” an automatic calculating machine that many consider to be the forerunner of today’s electronic computer. What Babbage realized was that that many long computations, especially those needed to prepare mathematical tables, consisted of routine operations that were regularly repeated; from this he surmised that it ought to be possible to do these operations automatically. By 1822 he had built a small working model for demonstration. With financial help from the British government, in 1823 Babbage started construction of a full-scale, steam-driven difference engine but lost interest in the project before completing it — partly because the machining techniques of his era weren’t precise enough to create so complex a device. Not for another century (1941) was serious attention again devoted to developing a calculating machine — this time, for generating mathematical tables needed by the World War II armies for determining the trajectory of ballistics. By now, state-of-the-art electronics had advanced to the point where mechanical devices weren’t even a consideration. The first electronic calculator was the ENIAC (for Electrical Numerical Integrator And Calculator), which used 18,000 vacuum tubes, occupied 1,800 square feet of floor space, consumed 180 kW of power (enough energy to power a city of 30,000), and ran hot enough to supply all the heat needed to warm the seven- story building it was housed in. The vacuum tubes were soon replaced with transistors (1955), which were supplanted in turn by the integrated circuit in 1964. The Making of a Microprocessor But the mindset was still that of counting, just at a faster pace. It wasn’t until the advent of the Central Processing Unit (CPU), in 1971, that the concept changed from counting to computing. That’s when logic was introduced into the counting process, and ushered in the era of the microprocessor. Simply put, computer logic means that the computer can be “taught” to choose EZ-COURSEWARE 1-3 Introduction different courses of action depending on the specific inputs it’s been given, especially input from previous calculations. For example, a computer used in a payroll department will “look” at how many income tax deductions a particular employee has chosen, then look at the employee’s gross salary, and then access the right look-up table based on both factors to decide how much tax to subtract from that person’s paycheck. Similarly, a computerized cash register in a supermarket can “remember” to add sales tax at the end of your bill for the paper towels and laundry soap in your grocery cart, but not for your tax-free onions and chicken wings. This is what separates a calculator from a computer: the ability to choose a course of action dependent on the outcome of a previous calculation. Some call it “machine reasoning.” It has since come to be known as programming. At first machine reasoning wasn’t all that swift—mostly because the electronics of that time wasn’t all that advanced. Where today’s Pentium processors sport more than 3 million transistors, the semiconductor makers of twenty years ago were hard pressed to fit a couple thousand transistors on a silicon chip. The first microprocessor chip was Intel’s 4004, a 4-bit processor that contained 2300 transistors and ran at 100 kilohertz (100 kHz).