`
`UNDERSTANDING SMALL MICROCONTROLLERS
`
`JAMES M. SIBIGTROTH
`
`®
`
`MOTOROLA
`ivislon
`CSIC Microcontraller 0
`
`1/17
`
`DOJ EX 1028
`
`
`
`.mMmmSQ.mdnat3VIednU
`
`SMImmrII.-noc0r
`
`James M. Sibigtrot/2
`
`Printed in U.S.A.
`
`© MOTOROLA INC.
`
`,1992
`
`2/17
`
`DOJ EX 1028
`
`
`
`Table of Contents
`
`Chapter 1 — What is a Microcontroller? ................................... ..
`Overall View of a Computer System ...... ..
`Computer System Inputs ............ ..
`Computer System Outputs ...... ..
`Central Processor Unit (CPU) .... ..
`Clock .............................
`.......... ..
`Computer Memory ........................ ..
`Computer Program ........................ ..
`The Microcontroller ...... ..
`Chapter 1 Review ..................................................................................................... ..
`
`Chapter 2 — Computer Numbers and Codes ............................................ ..
`Binary and Hexadecimal Numbers ............... ..
`ASCII Code ............................................... ..
`
`L'zun.l>4:Lor\2:\>»-
`mmmALNLmm
`'t_oi_ot\>t;Ji\2i~.>io
`
`..
`................................... ..2
`
`U- 0
`
`Computer Operation Codes (Opcodes) ..... ..
`Instruction Mnemonics and Assemblers
`Octal .......................................................... ..
`.... ..
`Binary Coded Decimal (BCD) .................................
`Chapter 2 Review ............................................
`..............
`
`Chapter 3 — Computer Memory and Parallel I/O
`Pigeon Hole Analogy ................... ..
`How a Computer Sees Memory ......... ..
`Kilobytes, Megabytes, and Gigabytes.
`Kinds of Memory ............................................... ..
`Random Access Memory (RAM) ................... ..
`Read-Only Memory (ROM) ......... ..
`Programmable ROM (PROM) ..... ..
`EPROM.
`.
`
`EEPROM ............... ..
`I/O as a Memory Type ....................... ..
`Internal Status and Control Registers...
`Memory Maps .......................................... ..
`Memory Peripherals
`
`Computer Architecture ................... ..
`CPU Registers .................... ..
`Timing ......................... ..
`CPU View of a Program
`CPU Operation ................ ..
`Detailed Operation of CPU Instructions .................................. ..
`Store Accumulator (Direct Addressing Mode) ........... ..
`Load Accumulator (Immediate Addressing Mode) ....... ..
`Conditional Branch .................. ..
`Subroutine Calls and Returns.....
`Playing Computer ................................ ..
`
`3/17
`
`DOJ EX 1028
`
`
`
`RESET Pin ....................................................................................................... ..4-21
`Power-On Reset .............................................................................. ..4—21
`Low—\/oltage Reset ....................................... ..
`—
`Watchdog Timer Reset ..................................................................................... ..4-21
`Illegal Address Reset ....................................................................................... ..4-22
`Interrupts . ............................................................................................................... . . 4-22
`External Interrupts ............................................................................................ . . 4-23
`On-chip Peripheral Interrupts ................. ..
`.
`.
`Software Interrupt (SW1) ....................... ..
`
`Chapter 5 — M68IIC05 Instruction Set ........................................... ., .... ., ................. ..5-1
`M68HC05 Central Processor Unit (CPU) ............................................................5-2
`Arithmetic/Logic Unit (ALU) ............................................................................ .. 5-2
`CPU Control . ,
`. .
`.
`. .
`.
`. .
`. ,
`. . . . , . . .
`. . .
`. . .
`I
`.
`. .
`. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
`. . . . . . . ..5-2
`CPU Registers . . .
`.
`.
`.
`. . .
`,
`. . . . . . .
`. . . . . . . . . ..,.5-3
`Accumulator (A) ......... ..'. .............................................................................. .. 5-3
`Index Register (X) ........................................................................................ 1| 5-4
`Condition Code Register (CCR) .................................................................. .. 5-4
`Half-Carry Bit (H) .................................................................................. .. 5-4
`Interrupt Mask Bit (I) ............................................................... ..5-4
`Negative (N) .......................................................................... ..5-5
`Zero (Z) .................................................................................................. ..5-5
`Carry/Borrow (C) ................................................................................... ..5-5
`Program Counter (PC) ................................................................................. .. 5-6
`Stack Pointer (SP) .......................................................................................... 5-7
`Addressing Modes ...................................................................................................5-7
`IMMEDIATE Addressing Mode ....................................................................... .. 5-9
`INHERENT-Addressing Mode ........................................................................ ..5-10
`EXTENDED Addressing Mode ....................................................................... ..5-12
`DIRECT Addressing Mode ................................................................................5—14
`INDEXED Addressing Mode .......................................................................... ..5-16
`Indexed—No Offset ................................................................................ .. 5-16
`Indexed-—8—Bit Offset ............................................................................. ..5-18
`Indexed——16—Bit Offset .............................................................................. :4 5-19
`RELATIVE Addressing Mode ......................................................................... .. 5-20
`Bit Test and Branch Instructions ...................................................................... ..5-22
`Instructions Organized by Type ............................................................................. ..5—22
`Instruction Set Summary ........................................................................................ .. 5-27
`Chapter 5 Review ................................................................................................... ..5—37
`
`Chapter 6 -- Programming ........................................................................................ ..6-1
`Writing a Simple Program ....................................................................................... ..6-2
`Flowchart ......................................... ..
`Mnemonic Source Code ................... ..
`Software Delay Program ......................................................................................6
`Assembler Listing .................................................................................... . . 6-7
`Object Code File ....................... ..
`Assembler Directives ............................................................................................. ,.6-13
`Originate (ORG) .............................................................................................. ..6-13
`Equate (EQU) ................................................................................................... ..6-13
`Form Constant Byte (FCB) .............................................................................. .. 6-14
`Form Double Byte (FDB) ................................................................................ ..6-14
`Reserve Memory Byte (RMB) ......................................................................... 4| 6-15
`
`4/17
`
`DOJ EX 1028
`
`
`
`..................
`..................
`Set Default Number Base to Decimal .........
`Instruction Set Dexterity
`..................
`....................................... ..
`Application Development ............................................. ..
`Chaptei'6
`........................
`
`................................... ..O\O\O\O\IIIt)v—ki———-)—-OO0O\Un
`
`................................................. ..
`
`.....
`Chapter‘? —The Paced Loop ....
`SystemEquates...,........................................
`Register Equates for MC68HC705l(1
`Application System Equates
`Vector
`Reset .......
`Unused
`RAM
`Paced
`Loop
`Loop System Clock....................
`
`................ ..
`
`Lil:
`
`
`
`esseaeox)-JC3\<3\-fixJia(:3(:3ix)ix)P-*
`
`r-a G
`
`Timing Considerations .............
`Stack Considerations ............... .. .
`An Application~Ready Framework.
`Chapter7Review ...............
`......................................................
`
`......
`..........y......
`
`.
`
`In
`
`.qggggIx)>-4r-dr—A(:3ix)r—a»-a
`
`Chapter 8 — On-Chip Peripheral Systems
`Types ofPeripherals..... ...............
`..............
`. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..4...........»........»...4......
`.....-.-........o
`................
`
`.... ..
`..........................
`Serial Ports
`Analog to Digital Converters (A/D)
`Digital to Analog Converters (D/A)...
`
`Controlling Peripherals ....................................................... ..
`The MC68HC’705K1 Timer
`A Timer Example .......
`Using The PWM Software ............................................................................... .. 8
`Chapter 8 Review .............
`.........................................
`..........
`..............
`......... ..8—
`?
`
`Appendix A -— M68HC05 Instruction Set Details. ............................
`
`................... ..
`
`Appendix B — Reference Tables ............
`ASCII to Hexadecimal Conversion...
`............................ ..
`.............
`Hexadecimal to Decimal Conversion ................
`.....................
`................... ..
`Decimal to Hexadecimal Conversion ...................
`Hexadecimal Values vs. M68HC05 Instructions ................. ..: ................................ ..
`
`..... ..
`
`...................
`
`.......................
`
`ooaxux4>-i>4>~oan'.~ax'on-
`I>—‘|—-‘*1|cox
`oxL'n.::-t'\>>-nr-I
`ewebe
`
`5/17
`
`DOJ EX 1028
`
`
`
`List of Figures
`
`Page
`Number
`
`Overall View of a Computer System ........................................................... .. 1-2
`Expanded View of a Microcontroller ........................................................... .. 1-7
`
`....3-7
`Memory and I/O Circuitry ..................... ..
`....3~9
`1/0 Port with Data Direction Control ........... ..
`.... .. 3~l0
`Expanded Detail of One Memory Location
`Typical Memory Map ................................................................................ .. 3- 11
`
`M68HCO5 CPU Registers ...................... ..
`Memory Map of Example Program ....... ..
`Subroutine Call Sequence ...................... ..
`Worksheet for Playing Computer .......... ..
`Completed Worksheet ............................ ..
`V
`Hardware Interrupt Flowchart ................ ..
`Interrupt Stacking Order ............................................................................ ..4—25
`
`....4-3
`....4—7
`
`M68HC05 CPU Block Diagram .................................................................. ..5~2
`Programming Model .................................................................................... ..5-3
`How Condition Codes are Affected by Arithmetic Operations ................... ..5—6
`
`......................................... ..6-3
`Example Flowchart ...........................................
`. . . . . . . . . . . . ..6-5
`Flowchart and Mnemonics i
`.
`. . . .
`.
`.
`. . . . . .
`. . . . . . . . . . . . . r . . I . .
`Delay Routine Flowchart and Mnemonics ................................................... ..6-6
`Explanation of Assembler Listing ................................................................ .. 6-9
`Syntax of an S! Record . .
`.
`. .
`.
`.
`A . . . .
`.
`. . . . . . . . . . . . . . . . . . . . . . . . .
`. . . . . . . . . . ..6-12
`S-Record File for Example Program . . . . . . . . . . . . . . . . . .
`. . . . . . . . . . .. 6-12
`Four Ways to Check a Switch .................................................................... .. 6~l7
`
`Flowchart of Main Paced Loop .................................................................... ..7-8
`Flowchart of RTI Interrupt Service Routine ................................................ ..7-9
`
`l5—Stage Multifunction Timer Block Diagram ............................................ .. 8~6
`PWM Wave Forms with Various Duty Cycles .......................... ..
`Portion of the MC68l*IC705K1 Timer ....................................... ..
`PWM with 16 Discrete Duty Cycle Outputs ........................... ..
`Each TOF Interrupt Sliced into 16 Separate Time Intervals
`Timer Interrupt Service Routine ............................................. ..
`Real Time lnterrutp Routine Flowchart ........... ..
`Timer Overflow Interrupt Flowchart ......................................................... .. 8-15
`
`3333 4 4444
`
`.4
`
`4 555 6
`
`'4'=.«.Lu\5»a
`hmmfimmw
`
`I
`
`LLn'o_-
`
`_
`
`u5&hmm~
`
`IItx.))—
`
`&hm&AmN—
`
`666666 77 8 8888 88 8
`
`6/17
`
`DOJ EX 1028
`
`
`
`Listings
`
`Listing
`Number
`
`Title
`
`Page
`Number
`
`4-1
`4-2
`
`6-1
`
`7-1
`
`8-1
`
`Example Program ......................................................................................... .. 4-6
`Subroutine Call Example ........................................................................... ..4—12
`
`Assembler Listing ........................................................................................ .. 6-8
`
`Paced Loop Framework Program ..................................................... ..7-14~7-19
`
`PVVDA Progrannlisdng ........................................................... .{.......... "8-17,8-18
`
`List of Tables
`
`"'39E(D
`
`Title
`
`Page
`Number
`
`Decimal, Binary, and Hexadecimal Equivalents ......................................... . . 2-3
`AS CII to Hexadecimal Conversion ............................... ..
`.. . 2-5
`Octal, Binary, and Hexadecimal Equivalents ..,............ ..
`:...2-7
`Decimal, BCD, Binary Equivalents ............................................................. ..2-8
`
`Vector Addresses for Resets and Interrupts (MC68HC705K1) ................. ..4-23
`
`IMMEDIATE Addressing Mode Instructions ............................................. ..5-9
`INHERENT Addressing Mode Instructions
`EXTENDED Addressing Mode Instructions ............................................. ..5- 13
`DIRECT Addressing Mode Instructions .................................................... ..5-15
`INDEXED (No Offset or 8-Bit Offset) Addressing Mode Instructions .... ..5-17
`INDEXED (16—Bit Offset) Addressing Mode Instructions ........................ ..5-20
`RELATIVE Addressing Mode Instructions ............................................... ..5-22
`Register/l\/Iemory Instructions .................................................................... ..S-23
`Read-Modify-Write Instructions ................................................................ ..5-24
`Branch Instructions .................................................................................... ..5-25
`Control Instructions .................................................................................... ..5-26
`Instruction Set Summary ................................................................... ..5-28~5-36
`
`RTI and COP Timer Rates (E-clock = 2.0 MHZ) ........................................ .. 8-7
`PWM Characteristics for Various RTI Rates ............................................. .. 8-11
`
`Hexadecimal to ASCII ................................................................................ .. B-3
`Hexadecimal to Decimal Conversion ......................................................... .. B-4
`Hexadecimal to M68HC05 Instruction Mnemonics ........................... .. B-6~B-9
`
`22 22 4 55
`
`i>oo\1oxL'n4>-oa1x.>+—-
`
`
`UILIIUIWP?onare().)[\)i—-‘[\)i—~[\.)i—-‘O
`
`5555555
`
`4>Cm'\>»'—‘
`
`2
`
`,._n
`
`-
`
`7/17
`
`DOJ EX 1028
`
`
`
`About This Textbook
`
`Welcome to the world of microcontrollers. This textbook will help you
`understand the inner workings of these small general purpose computers and then
`explain how to design tnicrocontrollers into useful applications. This book places
`special emphasis on the smallest microcontrollers in the Motorola M68HC05
`family although the ideas apply to all microcontrollers a11d even to the largest
`computers.
`
`This textbook does not assume any prior knowledge of microprocessors or
`software programming. Students can use this book in an instructor-led technical
`class. Experienced engineers can also use this book to learn about
`rnicrocontrollers.
`
`About This Textbook
`
`8/17
`
`DOJ EX 1028
`
`
`
`The following paragraphs provide a brief description of each
`chapter and appendix of this textbook.
`
`ll — What is a Microcontroller?
`
`This chapter introduces the major elements that make up any
`computer system. This chapter discusses different kinds of
`computer systems and the features
`that distinguish
`microcontrollers from other types of computer systems.
`
`9: — Computer Numbers and Codes
`
`This chapter explores the numbering systems and special
`codes used by computers. Computers count in binary (base 2)
`instead of decimal (base 10). The American Standard Code
`for Information Interchange (ASCII) is another code that lets
`computers work with alphabetic information. Finally
`computers use special coded instructions when they execute
`computer programs.
`
`3 — Computer Memory and Parallel I/O
`
`Memory is a basic building block of all computers. This
`chapter discusses several different kinds of memory. The
`idea of parallel 1/0 as a kind of memory is discussed. As the
`idea of a computer memory map is explained in detail, you
`will get your first View into the inner workings of a
`computer.
`
`43 — Computer Architecture
`
`This chapter describes the internal structure and operation of
`the M68I—IC05 central processing unit (CPU). This chapter
`will bring together the ideas that were presented in the first
`three chapters to show how computers operate. This detailed
`View of internal computer operations will make the
`subsequent discussions of software easier to understand.
`
`About This Textbook
`
`9/17
`
`DOJ EX 1028
`
`
`
`5 — M68HC05 Instruction Set
`
`This chapter begins with an overview of the M68HC05 CPU
`as seen by a programmer. Addressing modes are explained to
`show the different ways a program can specify the location
`of an operand. The instruction set is presented in three ways.
`First, instructions are grouped by addressing mode. Second,
`instructions are summarized by functional type. Finally the
`whole instruction set is summarized alphabetically.
`
`C33 — Programming
`
`Computers are not smart. They only do what the instructions
`in a program tell them to do. Computers only know how to
`perform a relatively small set of simple instructions. It is the
`endless combination of ways these instructions can be
`combined that allows computers to do so many different
`jobs. This chapter shows you how to prepare a set of
`instructions for the computer to execute. Assemblers and
`simulators are also discussed.
`
`7 — The Paced Loop
`
`This programming structure can be used as the basis for
`many microcontroller applications. Sub—tasks
`that are
`specific to an application can be written independently,These
`sub-tasks can then be added to the paced loop framework.
`
`— On-Chip
`
`Peripheral Systems
`
`Microcontrollers often include special purpose peripherals
`systems. This chapter describes the 15-bit multifunction
`timer that is found on small M68HCO5 microcontrollers. A
`
`complete design of a digital to analog converter is discussed
`including a software program that uses this timer to produce
`a PWM signal.
`
`About‘ This Textbook
`
`10/17
`
`DOJ EX 1028
`
`
`
`A — Instruction Set Details
`
`This appendix includes detailed descriptions of all M68HC05
`instructions.
`
`— Reference Tables
`
`This appendix includes useful conversion tables.
`
`Cetloeeemy
`
`Glossary items are highlighted as bold italic words or
`phrases where they first appear in the text.
`
`About This Textbook
`
`11/17
`
`DOJ EX 1028
`
`
`
`What is a Microcontroller?
`
`This chapter sets the groundwork for a detailed exploration of the inner workings
`of a small microcontroller. We will see that the microcontroller is one of the most
`
`basic forms of computer system. Although much smaller than its cousins, personal
`computers and mainframe computers, microcontrollers are built from the same
`basic elements. In the simplest sense, computers produce a specific pattern of
`outputs based on current inputs and the instructions in a computer program.
`
`Like most computers, microcontrollers are simply general purpose instruction
`executors. The real star of a computer system is a program of instructions that are
`provided by a human programmer. This program instructs the computer to perform
`long sequences of very simple actions to accomplish useful tasks as intended by the
`programmer.
`
`What is aMz'cr0co/-m'o1ler?
`
`12/17
`
`DOJ EX 1028
`
`
`
`Overall View of a Computer System
`
`Figure 1-1 is a high level view of a computer system. By
`simply changing the types of input and output devices this
`could be a view of a personal computer, a room-sized
`mainframe computer, or a simple microcontroller (MCU).
`The input and output (I/0) devices shown in the figure happen
`to be typical I/O devices found in a microcontroller computer
`system.
`
`P ROGRAM
`
`CENTRAL
`—
`OUTPUTS
`PROCESSOR
`UN” T
`(CPU)
`
`TEMPERATURE
`SENSOR
`
`CRYSTAL
`
`Figure 1-1.
`Overall View of a Computer System
`
`Computer System Inputs
`
`Input devices supply information to the computer system from
`the outside world. In a personal computer system, the most
`common input device is the typewriter~style keyboard.
`Mainframe computers use keyboards and punched card
`readers as input devices. Microcontroller computer systems
`usually use much simpler input devices such as individual
`switches or small keypads although much more exotic input
`devices are found in many microcontroller based systems. An
`example of an exotic input device for a microcontroller is the
`oxygen sensor in an automobile that measures the efficiency
`of combustion by sampling the exhaust gasses.
`
`What is a Microcontroller?
`
`13/17
`
`DOJ EX 1028
`
`
`
`Most microcontroller inputs can only process digital input
`signals at the same voltage levels as the main logic power
`source. The zero volt ground level is called V33 and the
`positive power source (VDD) is typically 5 Vdc. A level of
`approximately zero volts indicates a logic zero and a voltage
`approximately equal to the positive power source indicates a
`logic one signal.
`
`Of course the real world is full of analog signals, or signals
`that are some other voltage level. Some input devices translate
`signal voltages from some other level to the V131) and Vsg
`levels needed for the microcontroller. Other input devices
`convcrt analog signals into digital signals (binary values made
`up of ones and zeros) that the computer can understand and
`manipulate. Some microcontrollers even include such analog
`to digital converter circuits on the same integrated circuit.
`
`Transducers can be used to translate other real—world signals
`into logic level signals that a microcontroller can understand
`and manipulate. Some examples
`include temperature
`transducers, pressure sensors, light level detectors, and so
`forth. With such transducers, almost any physical property can
`be used as an input to a computer system.
`
`Computer System Outputs
`
`Output devices are used to communicate information or
`actions from the computer system to the outside world. In a
`personal computer system, the most common output device is
`the CRT display. Microcontroller systems often use much
`simpler output devices such as individual indicator lamps or
`beepers.
`
`Translation circuits (sometimes built into the same integrated
`circuit as the microcomputer) ca.n convert digital signals into
`analog voltage levels. If necessary, other circuits can translate
`V313 and V55 levels that are native to an MCU, into other
`voltage levels.
`
`The “controller” in microcontroller comes from the fact that
`these small computer systems usually control something as
`compared to a personal computer that usually processes
`information. In the case of the personal computer, most output
`is information (either displayed on a CRT screen or printed on
`paper). In a microcontroller system most outputs are logic T
`
`What is a Microco/m‘oller?
`
`1-3
`
`14/17
`
`DOJ EX 1028
`
`
`
`level digital signals that are used to drive display LEDs or
`electrical devices such as relays or motors.
`'
`
`Central Processor Unit (CPU)
`
`The CPU is at the center of every computer system. The job
`of the CPU is
`to obediently execute the program of
`instructions that were supplied by the programmer. A
`computer program instructs the CPU to read information
`from inputs, to read information from and write information to
`working memory, and to write information to outputs. Some
`program instructions involve simple decisions that cause the
`program to either continue with the next instruction or to skip
`to a new place in the program. In a later chapter we will look
`closely at the set of available instructions for a particular
`microcontroller.
`
`ln mainframe and personal computers there are actually layers
`of programs starting with internal programs that control the
`most basic operations of the computer. Another layer includes
`user programs that are loaded into the computer system
`memory when they are about to be used. This structure is very
`complex and would not be a good example to show a beginner
`how a computer works.
`
`In a microcontroller there is usually only one program at work
`in a particular control application. The M68HC05 CPU
`recognizes only about 60 different instructions but these are
`representative of the instruction sets of any computer system.
`This kind of computer system is a good model for learning the
`basics of computer operation because it is possible to know
`exactly what is happening at every tiny step as the CPU
`executes a program.
`
`Clock
`
`With very few exceptions, computers use a small clock
`oscillator to trigger the CPU to move from one step in a
`sequence to the next. In the chapter 011 computer architecture
`we will see that even the simple instructions of a
`microcontroller are broken down into a series of even more
`basic steps. Each of these tiny steps in the operation of the
`computer, takes one cycle of the CPU clock.
`
`What is a Microcmtrollcr?
`
`15/17
`
`DOJ EX 1028
`
`
`
`Computer Memory
`
`There are several kinds of computer memory that are used for
`various purposes in computer systems. The main. kinds of
`memory found in microcontroller systems are read-only
`memory (ROM) and random access read/write memory
`(RAM). ROM is used mainly for programs and permanent
`data that must remain unchanged even when there is no power
`applied to the microcontroller. RAM is used for temporary
`storage of data and intermediate calculation results during
`operation. Some microcontrollers include other kinds of
`memory such as erasable programmable read—only memory
`(EPROM) and electrically erasable programmable read-only
`memory (EEPROM). We will learn more about these kinds of
`I
`memory in a later chapter.
`
`The smallest unit of computer memory is a single bit that can
`store one value of zero or one. These bits are grouped into sets
`of 8 bits to make one byte. Larger computers further group
`bits into sets of 16 or 32 to make a unit called a word. The size
`
`of a word can be different for different computers, but a byte
`is always eight bits.
`
`Personal computers work with very large programs and large
`amounts of data so they use special "forms of memory called
`mass storage devices. Floppy disks, hard disks, and compact
`discs are memory devices of this type. It is not unusual to find
`several million bytes of RAM memory in a personal
`computer. Even this is not enough to hold the large programs
`and data used by personal computers so most personal
`computers also include a hard disk with tens or even hundreds
`of millions of bytes of storage capacity. Compact discs, very
`similar to those used for popular music recordings, have a
`capacity of about 600 million bytes of read~only memory.
`Small microcontroller systems typically have a total of 1
`thousand to 64 thousand bytes of memory.
`
`Computer Program
`
`Figure 1-1 shows the program as a cloud because it originates
`in the imagination of a computer programmer or engineer.
`This is comparable to an electrical engineer thinking up a new
`circuit or a mechanical engineer figuring out a new assembly.
`The components of a program are instructions from the
`instruction set of the CPU. Just as a circuit designer can build
`
`What is a Microconrroller?
`
`1-5
`
`16/17
`
`DOJ EX 1028
`
`
`
`an adder circuit out of simple AND, OR, and NOT elements, a
`pro grannner can write a program to add numbers together out
`of simple instructions.
`
`Programs are stored in the memory of a computer system
`where they can be sequentially executed by the CPU. In the
`chapter on programming, we will learn how to write programs
`and prepare them for loading into the memory of a computer.
`
`The Nlicrocontroller
`
`Now that we have discussed the Various parts of a computer
`system, we are ready to talk about just what a microcontroller
`is. The top half of figure 1-2 shows a generic computer system
`with a portion enclosed in a dashed outline. This outlined
`portion is a microcontroller and the lower half of the figure is
`a block diagram showing its internal structure in greater detail.
`The crystal is not contained within the microcontroller but it is
`a required part of the oscillator circuit. In some cases, a less
`expensive component such as a ceramic resonator or a
`resistor~eapacitor (R—C) circuit may be used instead of this
`crystal.
`
`A microcontroller can be defined as a complete computer
`system including a CPU, memory, a clock oscillator, and 1/0
`on a single integrated circuit chip. When some of these
`elements such as the l/O or memory are missing,
`the
`integrated circuit would be called a microprocessor. The CPU
`in a personal computer is a microprocessor. The CPU in a
`mainframe computer is made up of many integrated circuits.
`
`What is (I MicI‘0c0/1/rollei‘?
`
`17/17
`
`DOJ EX 1028