| |
| |
| |
Introduction to Microcontrollers | |
| |
| |
| |
Introduction | |
| |
| |
| |
Terminology | |
| |
| |
| |
The Central Processing Unit | |
| |
| |
| |
Semiconductor Memory: RAM and ROM | |
| |
| |
| |
The Buses: Address, Data, and Control | |
| |
| |
| |
Input/Output Devices | |
| |
| |
| |
Mass Storage Devices | |
| |
| |
| |
Human Interface Devices | |
| |
| |
| |
Control/Monitor Devices | |
| |
| |
| |
Programs: Big and Small | |
| |
| |
| |
Micros, Minis, and Mainframes | |
| |
| |
| |
Microprocessors vs. Microcontrollers | |
| |
| |
| |
Hardware Architecture | |
| |
| |
| |
Applications | |
| |
| |
| |
Instruction Set Features | |
| |
| |
| |
New Concepts | |
| |
| |
| |
Gains and Losses: A Design Example | |
| |
| |
Problems | |
| |
| |
| |
Hardware Summary | |
| |
| |
| |
MCS-51 Family Overview | |
| |
| |
| |
Once Around the Pins | |
| |
| |
| |
Port 0 | |
| |
| |
| |
Port 1 | |
| |
| |
| |
Port 2 | |
| |
| |
| |
Port 3 | |
| |
| |
| |
PSEN (Program Store Enable) | |
| |
| |
| |
ALE (Address Latch Enable) | |
| |
| |
| |
EA (External Access) | |
| |
| |
| |
RST (Reset) | |
| |
| |
| |
On-Chip Oscillator Inputs | |
| |
| |
| |
Power Connections | |
| |
| |
| |
I/O Port Structure | |
| |
| |
| |
Timing and the Machine Cycle | |
| |
| |
| |
Memory Organization | |
| |
| |
| |
General-Purpose RAM | |
| |
| |
| |
Bit-Addressable RAM | |
| |
| |
| |
Register Banks | |
| |
| |
| |
Special Function Registers | |
| |
| |
| |
Program Status Word | |
| |
| |
| |
B Register | |
| |
| |
| |
Stack Pointer | |
| |
| |
| |
Data Pointer | |
| |
| |
| |
Port Registers | |
| |
| |
| |
Timer Registers | |
| |
| |
| |
Serial Port Registers | |
| |
| |
| |
Interrupt Registers | |
| |
| |
| |
Power Control Register | |
| |
| |
| |
External Memory | |
| |
| |
| |
Accessing External Code Memory | |
| |
| |
| |
Accessing External Memory | |
| |
| |
| |
Address Decoding | |
| |
| |
| |
Overlapping the External Code and Data Spaces | |
| |
| |
| |
8032/8052 Enhancements | |
| |
| |
| |
Reset Operation | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Instruction Set Summary | |
| |
| |
| |
Introduction | |
| |
| |
| |
Addressing Modes | |
| |
| |
| |
Register Addressing | |
| |
| |
| |
Direct Addressing | |
| |
| |
| |
Indirect Addressing | |
| |
| |
| |
Immediate Addressing | |
| |
| |
| |
Relative Addressing | |
| |
| |
| |
Absolute Addressing | |
| |
| |
| |
Long Addressing | |
| |
| |
| |
Indexed Addressing | |
| |
| |
| |
Instruction Types | |
| |
| |
| |
Arithmetic Instructions | |
| |
| |
| |
Logical Instructions | |
| |
| |
| |
Data Transfer Instructions | |
| |
| |
| |
Boolean Instructions | |
| |
| |
| |
Program Branching Instructions | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Timer Operation | |
| |
| |
| |
Introduction | |
| |
| |
| |
Timer Mode Register (TMOD) | |
| |
| |
| |
Timer Control Register (TCON) | |
| |
| |
| |
Timer Modes and the Overflow Flag | |
| |
| |
| |
13-Bit Timer Mode (Mode 0) | |
| |
| |
| |
16-Bit Timer Mode (Mode 1) | |
| |
| |
| |
8-Bit Auto-Reload Mode (Mode 2) | |
| |
| |
| |
Split Timer Mode (Mode 3) | |
| |
| |
| |
Clocking Sources | |
| |
| |
| |
Interval Timing | |
| |
| |
| |
Event Counting | |
| |
| |
| |
Starting, Stopping, and Controlling the Timers | |
| |
| |
| |
Initializing and Accessing Timer Registers | |
| |
| |
| |
Reading a Timer "on the Fly" | |
| |
| |
| |
Short, Medium, and Long Intervals | |
| |
| |
| |
Producing Exact Frequencies | |
| |
| |
| |
Eliminating Round-off Errors | |
| |
| |
| |
Compensating for Overhead Due to Instructions | |
| |
| |
| |
8052 Timer 2 | |
| |
| |
| |
Auto-Reload Mode | |
| |
| |
| |
Capture Mode | |
| |
| |
| |
Baud Rate Generation | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Serial Port Operation | |
| |
| |
| |
Introduction | |
| |
| |
| |
Serial Communication | |
| |
| |
| |
Serial Port Buffer Register (SBUF) | |
| |
| |
| |
Serial Port Control Register (SCON) | |
| |
| |
| |
Modes of Operation | |
| |
| |
| |
8-Bit Shift Register (Mode 0) | |
| |
| |
| |
8-Bit UART with Variable Baud Rate (Mode 1) | |
| |
| |
| |
9-Bit UART with Fixed Baud Rate (Mode 2) | |
| |
| |
| |
9-Bit UART with Variable Baud Rate (Mode 3) | |
| |
| |
| |
Full Duplex Serial Communication: Issues | |
| |
| |
| |
Initialization and Accessing Serial Port Registers | |
| |
| |
| |
Receiver Enable | |
| |
| |
| |
The Ninth Data Bit | |
| |
| |
| |
Adding a Parity Bit | |
| |
| |
| |
Interrupt Flags | |
| |
| |
| |
Multiprocessor Communications | |
| |
| |
| |
Serial Port Baud Rates | |
| |
| |
| |
Using Timer 1 as the Baud Rate Clock | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Interrupts | |
| |
| |
| |
Introduction | |
| |
| |
| |
8051 Interrupt Organization | |
| |
| |
| |
Enabling and Disabling Interrupts | |
| |
| |
| |
Interrupt Priority | |
| |
| |
| |
Polling Sequence | |
| |
| |
| |
Processing Interrupts | |
| |
| |
| |
Interrupt Vectors | |
| |
| |
| |
Program Design Using Interrupts | |
| |
| |
| |
Small Interrupt Service Routines | |
| |
| |
| |
Large Interrupt Service Routines | |
| |
| |
| |
Timer Interrupts | |
| |
| |
| |
Serial Port Interrupts | |
| |
| |
| |
External Interrupts | |
| |
| |
| |
Interrupt Timings | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Assembly Language Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
Assembler Operation | |
| |
| |
| |
Pass One | |
| |
| |
| |
Pass Two | |
| |
| |
| |
Assembly Language Program Format | |
| |
| |
| |
Label Field | |
| |
| |
| |
Mnemonic Field | |
| |
| |
| |
Operand Field | |
| |
| |
| |
Comment Field | |
| |
| |
| |
Special Assembler Symbols | |
| |
| |
| |
Indirect Address | |
| |
| |
| |
Immediate Data | |
| |
| |
| |
Data Address | |
| |
| |
| |
Bit Address | |
| |
| |
| |
Code Address | |
| |
| |
| |
Generic Jumps and Calls | |
| |
| |
| |
Assemble-Time Expression Evaluation | |
| |
| |
| |
Number Bases | |
| |
| |
| |
Character Strings | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Special Operators | |
| |
| |
| |
Relational Operators | |
| |
| |
| |
Expression Examples | |
| |
| |
| |
Operator Precedence | |
| |
| |
| |
Assembler Directives | |
| |
| |
| |
Assembler State Control | |
| |
| |
| |
Symbol Definition | |
| |
| |
| |
Storage Initialization/Reservation | |
| |
| |
| |
Program Linkage | |
| |
| |
| |
Segment Selection Directives | |
| |
| |
| |
Assembler Controls | |
| |
| |
| |
Linker Operation | |
| |
| |
| |
Annotated Example: Linking Relocatable Segments and Modules | |
| |
| |
| |
ECHO.LST | |
| |
| |
| |
IO.LST | |
| |
| |
| |
Example.M51 | |
| |
| |
| |
Macros | |
| |
| |
| |
Parameter Passing | |
| |
| |
| |
Local Labels | |
| |
| |
| |
Repeat Operations | |
| |
| |
| |
Control Flow Operations | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
8051 C Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
Advantages and Disadvantages of 8051 C | |
| |
| |
| |
8051 C Compilers | |
| |
| |
| |
Data Types | |
| |
| |
| |
Memory Types and Models | |
| |
| |
| |
Arrays | |
| |
| |
| |
Structures | |
| |
| |
| |
Pointers | |
| |
| |
| |
A Pointer's Memory Type | |
| |
| |
| |
Typed Pointers | |
| |
| |
| |
Untyped Pointers | |
| |
| |
| |
Functions | |
| |
| |
| |
Parameter Passing | |
| |
| |
| |
Return Values | |
| |
| |
| |
Some 8051 C Examples | |
| |
| |
| |
The First Program | |
| |
| |
| |
Timers | |
| |
| |
| |
Serial Port | |
| |
| |
| |
Interrupts | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Program Structure and Design | |
| |
| |
| |
Introduction | |
| |
| |
| |
Advantages and Disadvantages of Structured Programming | |
| |
| |
| |
The Three Structures | |
| |
| |
| |
Statements | |
| |
| |
| |
The Loop Structure | |
| |
| |
| |
The Choice Structure | |
| |
| |
| |
Pseudo Code Syntax | |
| |
| |
| |
Assembly Language Programming Style | |
| |
| |
| |
Labels | |
| |
| |
| |
Comments | |
| |
| |
| |
Comment Blocks | |
| |
| |
| |
Saving Registers on the Stack | |
| |
| |
| |
The Use of Equates | |
| |
| |
| |
The Use of Subroutines | |
| |
| |
| |
Program Organization | |
| |
| |
| |
8051 C Programming Style | |
| |
| |
| |
Comments | |
| |
| |
| |
The Use of Defines | |
| |
| |
| |
The Use of Functions | |
| |
| |
| |
The Use of Arrays and Pointers | |
| |
| |
| |
Program Organization | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Tools and Techniques for Program Development | |
| |
| |
| |
Introduction | |
| |
| |
| |
The Development Cycle | |
| |
| |
| |
Software Development | |
| |
| |
| |
Hardware Development | |
| |
| |
| |
Integration and Verification | |
| |
| |
| |
Software Simulation | |
| |
| |
| |
Hardware Emulation | |
| |
| |
| |
Execution from RAM | |
| |
| |
| |
Execution from EPROM | |
| |
| |
| |
The Factory Mask Process | |
| |
| |
| |
Commands and Environments | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Design and Interface Examples | |
| |
| |
| |
Introduction | |
| |
| |
| |
The SBC-51 | |
| |
| |
| |
Hexadecimal Keypad Interface | |
| |
| |
| |
Interface to Multiple 7-Segment LEDs | |
| |
| |
| |
Interface to Liquid Crystal Displays (LCDs) | |
| |
| |
| |
Loudspeaker Interface | |
| |
| |
| |
Nonvolatile RAM Interface | |
| |
| |
| |
Input/Output Expansion | |
| |
| |
| |
Using Shift Registers | |
| |
| |
| |
Using the 8255 | |
| |
| |
| |
RS232 (EIA-232) Serial Interface | |
| |
| |
| |
Centronics Parallel Interface | |
| |
| |
| |
Analog Output | |
| |
| |
| |
Analog Input | |
| |
| |
| |
Interface to Sensors | |
| |
| |
| |
Interface to Relays | |
| |
| |
| |
Stepper Motor Interface | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
Design and Interface Examples in C | |
| |
| |
| |
Introduction | |
| |
| |
| |
Hexadecimal Keypad Interface | |
| |
| |
| |
Interface to Multiple 7-Segment LEDs | |
| |
| |
| |
Interface to Liquid Crystal Displays (LCDs) | |
| |
| |
| |
Loudspeaker Interface | |
| |
| |
| |
Nonvolatile RAM Interface | |
| |
| |
| |
Input/Output Expansion | |
| |
| |
| |
RS232 (EIA-232) Serial Interface | |
| |
| |
| |
Centronics Parallel Interface | |
| |
| |
| |
Analog Output | |
| |
| |
| |
Analog Input | |
| |
| |
| |
Interface to Sensors | |
| |
| |
| |
Interface to Relays | |
| |
| |
| |
Stepper Motor Interface | |
| |
| |
Problems | |
| |
| |
| |
Example Student Projects | |
| |
| |
| |
Introduction | |
| |
| |
| |
Home Security System | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
System Design | |
| |
| |
| |
Software Design | |
| |
| |
| |
Elevator System | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
System Design | |
| |
| |
| |
Software Design | |
| |
| |
| |
Tic-Tac-Toe | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
Software Design | |
| |
| |
| |
Calculator | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
Software Design | |
| |
| |
| |
Micromouse | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
System Design | |
| |
| |
| |
Software Design | |
| |
| |
| |
A Soccer-Playing Robot | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
System Design | |
| |
| |
| |
Software Design | |
| |
| |
| |
A Smart Card Application | |
| |
| |
| |
Basic Security Concepts | |
| |
| |
| |
Project Description | |
| |
| |
| |
System Specifications | |
| |
| |
| |
Software Design | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
| |
8051 Derivatives | |
| |
| |
| |
Introduction | |
| |
| |
| |
MCS-151 and MCS-251 | |
| |
| |
| |
Microcontrollers with Flash Memory and NVRAM | |
| |
| |
| |
Microcontrollers with ADCs and DACs | |
| |
| |
| |
High-Speed Microcontrollers | |
| |
| |
| |
Network Microcontrollers | |
| |
| |
| |
Secure Microcontrollers | |
| |
| |
Summary | |
| |
| |
Problems | |
| |
| |
Appendices | |
| |
| |
| |
Quick Reference Chart | |
| |
| |
| |
Opcode Map | |
| |
| |
| |
Instruction Definitions | |
| |
| |
| |
Special Function Registers | |
| |
| |
| |
8051 Data Sheet | |
| |
| |
| |
ASCII Code Chart | |
| |
| |
| |
MON51-An 8051 Monitor Program | |
| |
| |
| |
A Guide to Keil's [mu] Vision2 IDE | |
| |
| |
| |
A Guide to the 8052 Simulator | |
| |
| |
| |
The Advanced Encryption Standard | |
| |
| |
| |
Sources of 8051 Development Products | |
| |
| |
Bibliography | |
| |
| |
Index | |