68HC11 Notes
Total Page:16
File Type:pdf, Size:1020Kb
68HC11 Notes Version 1.1.1 Oct 30, 2006 Andrew J. Blauch School of Engineering 68HC11 Notes i DISCLAIMER: All software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose. COMPATABILITY: This software has been created and tested using the following development systems: Compiler(s): GCC 68HC11 compiler version 2.2 Processor(s): Motorola 68HC11 E1,E9 operating at 2 MHz E-clock Evaluation Board(s): Axiom Manufacturing CMM11E1-EVBU Axiom Manufacturing CME11E9-EVBU Simulators(s): 68HC11 EVBU Simulator Version 0.6. PySim11 Version 0.5 (developed by Andrew Sterian) Copyright © 2005 School of Engineering Grand Valley State University 68HC11 Notes ii Table of Contents 1 HC11 Microcontroller.................................................................................................1 1.1 Overview.............................................................................................................1 1.2 Memory Maps .....................................................................................................1 2 Communication between PC and EVBU .................................................................... 6 2.1 Overview.............................................................................................................6 2.2 Block Diagram ....................................................................................................7 3 Gcc 68HC11 Compiler................................................................................................8 3.1 Overview.............................................................................................................8 3.2 Library Functions................................................................................................8 3.3 BUFFALO Library Functions............................................................................. 8 3.4 Sample Source Code ...........................................................................................8 4 I/O Registers................................................................................................................9 4.1 Overview.............................................................................................................9 4.2 Memory Mapped I/O Register ............................................................................ 9 5 Parallel I/O ................................................................................................................11 5.1 Overview...........................................................................................................11 5.2 Output Ports.......................................................................................................11 5.3 Input Ports .........................................................................................................11 5.4 Bi-directional Ports ...........................................................................................12 6 I/O Register C Definitions.........................................................................................13 6.1 Overview...........................................................................................................13 6.2 Register Defines................................................................................................13 6.3 Register Usage...................................................................................................13 6.4 Bit Defines.........................................................................................................14 6.5 Bit Usage...........................................................................................................14 7 Clocks and Counters..................................................................................................15 7.1 Overview...........................................................................................................15 7.2 Clocks................................................................................................................15 7.3 Free Running Clock and Counter...................................................................... 16 7.3.1 Overview...................................................................................................16 7.3.2 Sample Source Code ................................................................................. 17 7.4 Real-Time Interrupt Clock ................................................................................ 18 7.5 Software Timing Measurements ....................................................................... 19 7.5.1 Example – Measuring a Pulse Width........................................................20 7.5.2 Example – Generating a Pulse Width .......................................................22 8 Events and Flags........................................................................................................24 8.1 Overview...........................................................................................................24 8.2 Polling Technique .............................................................................................25 8.2.1 Overview...................................................................................................25 8.2.2 Sample Source Code ................................................................................. 25 8.3 Interrupt Technique...........................................................................................26 8.3.1 Overview...................................................................................................26 8.3.2 Sample Source Code ................................................................................. 26 68HC11 Notes iii 8.3.3 Terminology..............................................................................................27 8.3.4 Sequence of Operation.............................................................................. 29 9 Timer Overflow.........................................................................................................30 9.1 Overview...........................................................................................................30 9.2 Sample Source Code .........................................................................................30 10 Real-Time Interrupt...............................................................................................31 10.1 Overview...........................................................................................................31 10.2 Sample Source Code .........................................................................................31 11 Output Compares...................................................................................................32 11.1 Overview...........................................................................................................32 11.2 Output Compare 1.............................................................................................33 11.3 Output Compares 2…5......................................................................................33 11.4 Examples...........................................................................................................34 11.4.1 Generating a Pulse Width (Output Compare 1) ........................................34 11.4.2 Generating a Pulse Width (Output Compare 2) ........................................35 11.4.3 Generating a Pulse Width (Output Compare 1 and 2) ..............................36 11.4.4 Generating a PWM Signal (Output Compare 1 and 2) .............................37 12 Input Captures.......................................................................................................38 12.1 Overview...........................................................................................................38 12.2 Example – Measuring a Pulse Width................................................................ 39 13 Analog-to-Digital Conversion...............................................................................40 13.1 Overview...........................................................................................................40 13.2 Configuration ....................................................................................................41 14 Serial Communication Interface (SCI).................................................................. 42 14.1 Overview...........................................................................................................42 14.2 Baud Rate..........................................................................................................43 14.3 Transmit/Receive Data......................................................................................44 15 Pulse Accumulator ................................................................................................45 15.1 Overview...........................................................................................................45 15.2 Configuration ....................................................................................................45 15.3 Event Counting Mode .......................................................................................46 15.4 Gated Time Accumulation Mode...................................................................... 46 16 Interrupt Requests .................................................................................................47