220 likes | 447 Views
Chapter 1: Introduction to 68HC11. The 68HC11 Microcontroller. What is a computer ?. Software. Hardware. Computer Hardware Organization. Control unit. common bus. Arithmetic logic unit. memory. output. input. Registers. program. data. unit. unit. storage. storage.
E N D
Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller
What is a computer? Software Hardware Computer Hardware Organization Control unit common bus Arithmetic logic unit memory output input Registers program data unit unit storage storage Figure 1.1 Computer hardware organization
The processor Registers -- storage locations in the processor Arithmetic logic unit Control unit program counter keeps track of the address of the next instruction to be executed status register flags the instruction execution result Themicroprocessor A processor implemented on a very large scale integration (VLSI) chip Peripheral chips are needed to construct a product The Microcontroller The processor and peripheral functions implemented on one VLSI chip
Featuresof the 68HC11A8 microcontroller - 8-bit CPU - 256 bytes SRAM - 512 bytes EEPROM - 8 KB ROM - 3 input capture channels - 5 output compare functions - one 8-bit pulse accumulator - one serial communication interface (SCI) - one serial peripheral interface (SPI) - real-time interrupt (RTI) circuit - 8-channel 8-bit A/D converter - computer operate properly (COP) watchdog system
Examples of microcontroller applications - Displays - Printers - Keyboards - Modems - Charge card phones - Refrigerators - Washing machines - Microwave ovens - Automobile engine fuel injection - Fax machines - Motor speed control - etc.
Semiconductor memory - - Random-access memory (RAM): same amount of time is required to access any location on the same chip Read-only memory (ROM): can only be read but not written by the processor Random-access memory - Dynamic random-access memory (DRAM): periodic refresh is required to maintain the contents of a DRAM chip - Static random-access memory (SRAM): no periodic refresh is required Read-only memory - Mask-programmed read-only memory (MROM): programmed when being manufactured - Programmable read-only memory (PROM): the memory chip can be programmed by the end user
- Erasable programmable ROM (EPROM) 1.electrically programmable many times 2. erased by ultraviolet light (through a window) 3. erasable in bulk (whole chip in one erasure operation) - Electrically erasable programmable ROM (EEPROM) 1. electrically programmable many times 2. electrically erasable many times 3. can be erased one location, one row, or whole chip in one operation - Flash memory 1. electrically programmable many times 2. electrically erasable many times 3. can only be erased in bulk
Computer software - Computer programs are known as software - A program is a sequence of instructions Machine instruction - A sequence of binary digits which can be executed by the processor - Hard to understand for human being Assembly language - Defined by assembly instructions - An assembly instruction is a mnemonic representation of a machine instruction - Assembly programs must be translated before it can be executed -- translated by an assembler
High-level language - Syntax of a high-level language is similar to English - A translator is required to translate the program written in a high-level language -- done by a compiler Source code - A program written in assembly or high-level language Object code - The output of an assembler or compiler
Memory Addressing Memory consists of addressable locations A memory location has 2 components: address and contents contents address Data transfer between CPU and memory involves address bus and data bus address bus lines CPU memory data bus lines Figure 1.5 Data transfer between CPU and memory
Goals Upon Completion • Understand Positional Number Systems • • Convert from one base to another • • Add, Subtract using Binary Numbers
Binary Number Representation Sign & Magnitude Ones Complement Twos Complement Codes Binary Addition Using Ones and Twos Complement Using BCD Nines and Tens Complement Binary Subtraction Chapter Overview
In Base 10 the weights in positional notation are: a0 is units weight a1 is 10 units weight a2 is 100 units weight or 10 * a1 weight ... In Base 2 the weights in positional notation are: a0 is units weight a1 is 2 units weight a2 is 4 units weight or 2 * a1 weight ... Binary Weights
BASE 10953.7810 = 9 x 102 + 5 x 101 + 3 x 100 + 7 x 10-1 + 8 x 10-2 BASE 21011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2 = 8 + 0 + 2 + 1 + 1/2 + 1/4 = 11 3/4 = 11.75 Positional Notation
EXAMPLE (repeated division) Convert 5310 to binary2 53 divided by 2 leaves 26 2’s with 1 leftover which forms least significant bit 2 26 remainder = 1 = a02 13 remainder = 0 = a12 6 remainder = 1 = a22 3 remainder = 0 = a32 1 remainder = 1 = a40 remainder = 1 = a5 most significant digit 53 base 10 equals 110101 32 + 16 + 4 + 1 = 53 Conversion
EXAMPLE (fractional portion requires repeated multiplication)Convert .62510 to binary.625 X 2 = 1.250 a-1 = 1 remainder = .250 after 1.0 subtraction ms digit .250 X 2 = 0.500 a-2 = 0 remainder = .500 .500 x 2 = 1.000 a-3 = 1 remainder = .000 Finished - No further multiplication possible! .1012 = .5 + 0 + .125 =.62510
EXAMPLEConvert 0.710 to binary.700 X 2 = 1.400 a-1 = 1 remainder = .400 .400 X 2 = 0.800 a-2 = 0 remainder = .800 .800 X 2 = 1.600 a-3 = 1 remainder = .600 .600 X 2 = 1.200 a-4 = 1 remainder = .200 .200 X 2 = 0.400 a-5 = 0 remainder = .400 .400 X 2 = 0.800 a-6 = 0 remainder = .800 Process starts to repeat 0.710 = 0.10110011001100.........(base 2)
WRITING one’s and zero’s can be error prone when dealing with large numbers. IBM came up with the following method of dealing with these numbers. BASE 16 with digits 0 - 15 in base 10 are represented by the following notation in Hexadecimal. 016 = 00002 = 010 816 = 10002 = 810 116 = 00012 = 110 916 = 10012 = 910 216 = 00102 = 210 A16 = 10102 = 1010 316 = 00112 = 310 B16 = 10112 = 1110 416 = 01002 = 410 C16 = 11002 = 1210 516 = 01012 = 510 D16 = 11012 = 1310 616 = 01102 = 610 E16 = 11102 = 1410 716 = 01112 = 710 F16 = 11112 = 1510 HEXADECIMAL NUMBERSCode