| |
| |
Preface | |
| |
| |
| |
Introduction to Motorola 68HC11 | |
| |
| |
| |
Objectives | |
| |
| |
| |
What is a Computer? | |
| |
| |
| |
The Processor | |
| |
| |
| |
Memory | |
| |
| |
| |
The Computer's Software | |
| |
| |
| |
The 68HC11 CPU Registers | |
| |
| |
| |
Memory Addressing | |
| |
| |
| |
The 68HC11 Addressing Modes | |
| |
| |
| |
Immediate (IMM) | |
| |
| |
| |
Direct Mode (DIR) | |
| |
| |
| |
Extended Mode (EXT) | |
| |
| |
| |
Indexed Mode (INDX, INDY) | |
| |
| |
| |
Inherent Mode (INH) | |
| |
| |
| |
Relative Mode (REL) | |
| |
| |
| |
A Sample of 68HC11 Instructions | |
| |
| |
| |
The LOAD Instruction | |
| |
| |
| |
The ADD Instruction | |
| |
| |
| |
The SUB Instruction | |
| |
| |
| |
The STORE Instruction | |
| |
| |
| |
The 68HC11 Machine Code | |
| |
| |
| |
A Machine Code Sequence | |
| |
| |
| |
Decoding Machine Language Instructions | |
| |
| |
| |
The Instruction Execution Cycle | |
| |
| |
| |
Instruction Timing | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
68HC11 Assembly Programming | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
Assembly Language Program Structure | |
| |
| |
| |
The Global View of a 68HC11 Assembly Program | |
| |
| |
| |
The Local View of a 68HC11 Assembly Program | |
| |
| |
| |
A Sample of Assembler Directives | |
| |
| |
| |
Flowcharts | |
| |
| |
| |
Writing Programs to Do Arithmetic | |
| |
| |
| |
The Carry/Borrow Flag | |
| |
| |
| |
Multiprecision Addition | |
| |
| |
| |
Subtraction and the C Flag | |
| |
| |
| |
Multiprecision Subtraction | |
| |
| |
| |
Binary-Coded Decimal Addition | |
| |
| |
| |
Multiplication and Division | |
| |
| |
| |
Program Loops | |
| |
| |
| |
The Condition Code Register | |
| |
| |
| |
Conditional Branch Instructions | |
| |
| |
| |
Decrementing and Incrementing Instructions | |
| |
| |
| |
Compare Instructions | |
| |
| |
| |
Special Conditional Branch Instructions | |
| |
| |
| |
Instructions for Variable Initialization | |
| |
| |
| |
Shift and Rotate Instructions | |
| |
| |
| |
Program Execution Time | |
| |
| |
| |
68HC11 Development Tools | |
| |
| |
| |
Software Tools | |
| |
| |
| |
68HC11 Evaluation Boards | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
Data Structures and Subroutine Calls | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
The Stack | |
| |
| |
| |
Indexable Data Structures | |
| |
| |
| |
Strings | |
| |
| |
| |
Subroutines | |
| |
| |
| |
Subroutine Call and Return | |
| |
| |
| |
Issues in Subroutine Calls | |
| |
| |
| |
The Stack Frame | |
| |
| |
| |
Examples of Subroutine Calls | |
| |
| |
| |
Using Registers to Pass Parameters | |
| |
| |
| |
Using the Stack to Pass Parameters | |
| |
| |
| |
Input and Output Routines | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
C Language Programming | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction to C | |
| |
| |
| |
Types, Operators, and Expressions | |
| |
| |
| |
Data Types | |
| |
| |
| |
Declarations | |
| |
| |
| |
Constants | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Bitwise Operators | |
| |
| |
| |
Relational and Logical Operators | |
| |
| |
| |
Control Flow | |
| |
| |
| |
If-Else Statement | |
| |
| |
| |
Multiway Conditional Statement | |
| |
| |
| |
Switch Statement | |
| |
| |
| |
For-Loop Statement | |
| |
| |
| |
While Statement | |
| |
| |
| |
Do-While Statement | |
| |
| |
| |
Input and Output | |
| |
| |
| |
Functions and Program Structure | |
| |
| |
| |
Pointers and Arrays | |
| |
| |
| |
Pointers and Addresses | |
| |
| |
| |
Arrays | |
| |
| |
| |
Pointers and Arrays | |
| |
| |
| |
Passing Arrays to a Function | |
| |
| |
| |
Miscellaneous Items | |
| |
| |
| |
External Variables | |
| |
| |
| |
Scope Rules | |
| |
| |
| |
Using the ImageCraft C Compiler (ICC11) | |
| |
| |
| |
Adjust the ImageCraft C Compiler | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
Operation Modes and Memory Expansion | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
A Summary of 68HC11 Signal Pins | |
| |
| |
| |
68HC11 Operation Modes | |
| |
| |
| |
Single Chip Mode | |
| |
| |
| |
Expanded Mode | |
| |
| |
| |
Special Bootstrap Mode | |
| |
| |
| |
Special Test Mode | |
| |
| |
| |
Setting the Operation Mode | |
| |
| |
| |
Memory Technology Overview | |
| |
| |
| |
Memory Component Types | |
| |
| |
| |
Memory Capacity and Organization | |
| |
| |
| |
Memory Addressing | |
| |
| |
| |
External Memory Expansion for 68HC11 | |
| |
| |
| |
Memory Space Assignment | |
| |
| |
| |
Address Decoding Methods | |
| |
| |
| |
Bus Cycles | |
| |
| |
| |
Conventions of Timing Diagrams | |
| |
| |
| |
The 68HC11 Bus Cycle Timing Diagram | |
| |
| |
| |
Adding External Memory to the 68HC11 | |
| |
| |
| |
Programming 68HC711E9 Devices with PCbug11 and 68HC11EVBU | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
Interrupts and Resets | |
| |
| |
| |
Objectives | |
| |
| |
| |
Basics of Interrupts | |
| |
| |
| |
What is an Interrupt? | |
| |
| |
| |
Why are Interrupts Used? | |
| |
| |
| |
Interrupt Maskability | |
| |
| |
| |
Interrupt Priority | |
| |
| |
| |
Interrupt Service | |
| |
| |
| |
Interrupt Vector | |
| |
| |
| |
Interrupt Programming | |
| |
| |
| |
Overhead of Interrupts | |
| |
| |
| |
Resets | |
| |
| |
| |
68HC11 Interrupts | |
| |
| |
| |
68HC11 Interrupt Handling Procedure | |
| |
| |
| |
Priority Structure of the 68HC11 Maskable Interrupts | |
| |
| |
| |
Nonmaskable Interrupts | |
| |
| |
| |
Low-Power Modes | |
| |
| |
| |
The WAIT Instruction | |
| |
| |
| |
The STOP Instruction | |
| |
| |
| |
The 68HC11 Resets | |
| |
| |
| |
External Reset Pin | |
| |
| |
| |
Power-On Reset | |
| |
| |
| |
CPU after Reset | |
| |
| |
| |
Establishing Mode of Operation | |
| |
| |
| |
Computer Operating Properly (COP) Watchdog Timer Reset | |
| |
| |
| |
Clock Monitor Reset | |
| |
| |
| |
68HC11 Interrupt Programming | |
| |
| |
| |
Writing the Interrupt Service Routine | |
| |
| |
| |
Set Up Interrupt Vector Table | |
| |
| |
| |
Enable Interrupts | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
Parallel I/O Ports | |
| |
| |
| |
Objectives | |
| |
| |
| |
Basic I/O Concepts | |
| |
| |
| |
I/O Addressing | |
| |
| |
| |
I/O Transfer Synchronization | |
| |
| |
| |
Synchronizing the Microprocessor and Interface Chip | |
| |
| |
| |
Synchronizing the Interface Chip and I/O Device | |
| |
| |
| |
68HC11 Parallel I/O Overview | |
| |
| |
| |
Bidirectional I/O (Ports C and D) | |
| |
| |
| |
Fixed Direction I/O (Ports A, B, and E) | |
| |
| |
| |
Port Registers and I/O Operation | |
| |
| |
| |
68HC11 Strobed I/O | |
| |
| |
| |
Strobed Input Port C | |
| |
| |
| |
Strobed Output Port B | |
| |
| |
| |
Port C Handshake I/O | |
| |
| |
| |
Port C Input Handshake Protocol | |
| |
| |
| |
Port C Output Handshake Protocol | |
| |
| |
| |
Simple Input Devices | |
| |
| |
| |
Interfacing Parallel Ports to the Keyboard | |
| |
| |
| |
Keyboard Scanning Techniques | |
| |
| |
| |
Keyboard Debouncing | |
| |
| |
| |
ASCII Code Table Lookup | |
| |
| |
| |
Interfacing 68HC11 to a Keypad | |
| |
| |
| |
Simple Output Devices | |
| |
| |
| |
A Single LED | |
| |
| |
| |
The Seven-Segment Display | |
| |
| |
| |
Liquid Crystal Displays (LCDs) | |
| |
| |
| |
The Optrex DMC-20434 LCD Kit | |
| |
| |
| |
Interfacing with a D/A Converter Using the 68HC11 Output Ports | |
| |
| |
| |
Centronics Printer Interface | |
| |
| |
| |
The i8255 Programmable Peripheral Interface | |
| |
| |
| |
Operation of the i8255 | |
| |
| |
| |
i8255 Operation Modes | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
68HC11 Timer Functions | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
Free-Running Main Timer | |
| |
| |
| |
Input-Capture Functions | |
| |
| |
| |
Applications of the Input-Capture Function | |
| |
| |
| |
Output-Compare Functions | |
| |
| |
| |
Operation of the Output-Compare Function | |
| |
| |
| |
Applications of the Output-Compare Function | |
| |
| |
| |
Use OC1 to Control Multiple Output-Compare Functions | |
| |
| |
| |
Forced Output-Compare | |
| |
| |
| |
Real-Time Interrupt (RTI) | |
| |
| |
| |
Pulse Accumulator | |
| |
| |
| |
Pulse Accumulator-Related Registers | |
| |
| |
| |
Pulse Accumulator Applications | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
68HC11 Serial Communication Interface | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
RS232 Standard | |
| |
| |
| |
EIA-232-E Electrical Specification | |
| |
| |
| |
EIA-232-E Functional Specification | |
| |
| |
| |
EIA-232-E Mechanical Specification | |
| |
| |
| |
EIA-232-E Procedural Specification | |
| |
| |
| |
Data Transmission Errors | |
| |
| |
| |
The Null Modem Connection | |
| |
| |
| |
The 68HC11 Serial Communication Interface (SCI) | |
| |
| |
| |
Data Format | |
| |
| |
| |
Wake-Up Feature | |
| |
| |
| |
Start Bit Detection | |
| |
| |
| |
Determining the Logic Value of Data Bits | |
| |
| |
| |
Receive the Stop Bit | |
| |
| |
| |
Receive Errors | |
| |
| |
| |
The Receive Process of a Character | |
| |
| |
| |
The Transmitting Process of a Character | |
| |
| |
| |
SCI Registers | |
| |
| |
| |
SCI Interfacing | |
| |
| |
| |
Serial Communication Support Chips | |
| |
| |
| |
The MC6850 ACIA | |
| |
| |
| |
ACIA Registers | |
| |
| |
| |
The ACIA Operation | |
| |
| |
| |
The Bus Timing of ACIA | |
| |
| |
| |
Interfacing an ACIA to the 68HC11 | |
| |
| |
| |
Configuring the ACIA | |
| |
| |
| |
A Terminal I/O Package for ACIA | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
68HC11 Serial Peripheral Interface | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
Signal Pins | |
| |
| |
| |
SPI-Related Registers | |
| |
| |
| |
Serial Peripheral Control Register (SPCR) | |
| |
| |
| |
Serial Peripheral Status Register (SPSR) | |
| |
| |
| |
Port D Data Direction Register (DDRD) | |
| |
| |
| |
SPI Operation | |
| |
| |
| |
SPI Circuit Connection | |
| |
| |
| |
SPI Data Transfer | |
| |
| |
| |
Simulating the SPI | |
| |
| |
| |
SPI-Compatible Peripheral Chips | |
| |
| |
| |
Interfacing the HC589 to SPI | |
| |
| |
| |
HC589 Pins | |
| |
| |
| |
Circuit Connection of HC589 and the SPI | |
| |
| |
| |
Interfacing the HC595 to SPI | |
| |
| |
| |
HC595 Pins | |
| |
| |
| |
Circuit Connection of HC595 and the SPI | |
| |
| |
| |
Interfacing the MC14489 to SPI | |
| |
| |
| |
The Signal Pins of the MC14489 | |
| |
| |
| |
Operation of the MC14489 | |
| |
| |
| |
Cascading the MC14489s | |
| |
| |
| |
Interfacing LCDs with SPI | |
| |
| |
| |
MC145000 and MC145001 LCD Drivers | |
| |
| |
| |
Interfacing the MC145000 and MC145001 to the 68HC11 | |
| |
| |
| |
The MC68HC68T1 Real Time Clock with Serial Interface | |
| |
| |
| |
MC68HC68T1 Signal Pins | |
| |
| |
| |
On-Chip RAM and Registers | |
| |
| |
| |
The MC68HC68T1 Operation and Interfacing the 68HC68TI to the 68HC11 | |
| |
| |
| |
Power Control | |
| |
| |
| |
Watchdog Function | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
| |
Analog-to-Digital Converter | |
| |
| |
| |
Objectives | |
| |
| |
| |
Introduction | |
| |
| |
| |
Successive Approximation Method | |
| |
| |
| |
Signal Conditioning Circuits | |
| |
| |
| |
Optimal Voltage Range for the A/D Converter | |
| |
| |
| |
Voltage Scaling Circuit | |
| |
| |
| |
Voltage Shifting and Scaling Circuit | |
| |
| |
| |
An Overview of the 68HC11 A/D Converter | |
| |
| |
| |
A/D System Options | |
| |
| |
| |
The Clock Frequency Issue | |
| |
| |
| |
A/D System Registers | |
| |
| |
| |
A/D Result Registers 1, 2, 3 and 4 (ADR1, ADR2, ADR3, and ADR4) | |
| |
| |
| |
A/D Control/Status Register | |
| |
| |
| |
OPTION Register | |
| |
| |
| |
Procedure for Using the A/D System | |
| |
| |
| |
Measuring the Temperature | |
| |
| |
| |
Measuring the Humidity | |
| |
| |
| |
Processing the A/D Results | |
| |
| |
| |
Using the External A/D Converter MAX1241 | |
| |
| |
| |
MAX1241 Signal Pins | |
| |
| |
| |
Chip Functioning | |
| |
| |
| |
Timing and Control | |
| |
| |
| |
Interfacing the MAX1241 with the 68HC11 | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Lab Exercises and Assignments | |
| |
| |
Appendixes | |
| |
| |
| |
Number Systems | |
| |
| |
| |
Design Projects | |
| |
| |
| |
68HC11A8 Register and Control Bit Summary | |
| |
| |
| |
Instruction Listing by Alphabetical Order | |
| |
| |
| |
Interrupt Vectors and Demo Board Vector Table | |
| |
| |
| |
SPI-Compatible Chips | |
| |
| |
| |
68HC11 Development Tool Vendors | |
| |
| |
| |
Standard Values of Commercially Available Resistors | |
| |
| |
| |
Data Sheets | |
| |
| |
Glossary | |
| |
| |
Index | |