Title:
The 8051 microcontroller
Personal Author:
Edition:
4th ed.
Publication Information:
Upper Saddle River, NJ : Prentice-Hall, 2007
ISBN:
9780130195623
Added Author:
Available:*
Library | Item Barcode | Call Number | Material Type | Item Category 1 | Status |
---|---|---|---|---|---|
Searching... | 30000010159408 | TJ223.M53 M324 2007 | Open Access Book | Book | Searching... |
Searching... | 33000000001524 | TJ223.M53 M324 2007 | Open Access Book | Gift Book | Searching... |
On Order
Summary
Summary
For 8051 Microcontroller courses requiring a time tested and classroom proven textbook. MacKenzie's 8051 Microcontroller text emphasises the programming of the 8051 by illustrating the two most widely used programming methods; Assembly Language and C programming. This text assumes no prior knowledge of the subject and progressively introduces 8051 Microcontroller concepts while reinforcing those concepts with plenty of examples and exercies.
Table of Contents
1 Introduction to Microcontrollers | p. 1 |
1.1 Introduction | p. 1 |
1.2 Terminology | p. 3 |
1.3 The Central Processing Unit | p. 4 |
1.4 Semiconductor Memory: RAM and ROM | p. 5 |
1.5 The Buses: Address, Data, and Control | p. 6 |
1.6 Input/Output Devices | p. 7 |
1.6.1 Mass Storage Devices | |
1.6.2 Human Interface Devices | |
1.6.3 Control/Monitor Devices | |
1.7 Programs: Big and Small | p. 8 |
1.8 Micros, Minis, and Mainframes | p. 9 |
1.9 Microprocessors vs. Microcontrollers | p. 10 |
1.9.1 Hardware Architecture | |
1.9.2 Applications | |
1.9.3 Instruction Set Features | |
1.10 New Concepts | p. 12 |
1.11 Gains and Losses: A Design Example | p. 13 |
Problems | p. 14 |
2 Hardware Summary | p. 17 |
2.1 MCS-51 Family Overview | p. 17 |
2.2 Once Around the Pins | p. 18 |
2.2.1 Port 0 | |
2.2.2 Port 1 | |
2.2.3 Port 2 | |
2.2.4 Port 3 | |
2.2.5 PSEN (Program Store Enable) | |
2.2.6 ALE (Address Latch Enable) | |
2.2.7 EA (External Access) | |
2.2.8 RST (Reset) | |
2.2.9 On-Chip Oscillator Inputs | |
2.2.10 Power Connections | |
2.3 I/O Port Structure | p. 22 |
2.4 Timing and the Machine Cycle | p. 23 |
2.5 Memory Organization | p. 24 |
2.5.1 General-Purpose RAM | |
2.5.2 Bit-Addressable RAM | |
2.5.3 Register Banks | |
2.6 Special Function Registers | p. 28 |
2.6.1 Program Status Word | |
2.6.2 B Register | |
2.6.3 Stack Pointer | |
2.6.4 Data Pointer | |
2.6.5 Port Registers | |
2.6.6 Timer Registers | |
2.6.7 Serial Port Registers | |
2.6.8 Interrupt Registers | |
2.6.9 Power Control Register | |
2.7 External Memory | p. 36 |
2.7.1 Accessing External Code Memory | |
2.7.2 Accessing External Memory | |
2.7.3 Address Decoding | |
2.7.4 Overlapping the External Code and Data Spaces | |
2.8 8032/8052 Enhancements | p. 41 |
2.9 Reset Operation | p. 43 |
Summary | p. 44 |
Problems | p. 44 |
3 Instruction Set Summary | p. 49 |
3.1 Introduction | p. 49 |
3.2 Addressing Modes | p. 50 |
3.2.1 Register Addressing | |
3.2.2 Direct Addressing | |
3.2.3 Indirect Addressing | |
3.2.4 Immediate Addressing | |
3.2.5 Relative Addressing | |
3.2.6 Absolute Addressing | |
3.2.7 Long Addressing | |
3.2.8 Indexed Addressing | |
3.3 Instruction Types | p. 59 |
3.3.1 Arithmetic Instructions | |
3.3.2 Logical Instructions | |
3.3.3 Data Transfer Instructions | |
3.3.4 Boolean Instructions | |
3.3.5 Program Branching Instructions | |
Summary | p. 78 |
Problems | p. 78 |
4 Timer Operation | p. 87 |
4.1 Introduction | p. 87 |
4.2 Timer Mode Register (TMOD) | p. 89 |
4.3 Timer Control Register (TCON) | p. 89 |
4.4 Timer Modes and the Overflow Flag | p. 90 |
4.4.1 13-Bit Timer Mode (Mode 0) | |
4.4.2 16-Bit Timer Mode (Mode 1) | |
4.4.3 8-Bit Auto-Reload Mode (Mode 2) | |
4.4.4 Split Timer Mode (Mode 3) | |
4.5 Clocking Sources | p. 92 |
4.5.1 Interval Timing | |
4.5.2 Event Counting | |
4.6 Starting, Stopping, and Controlling the Timers | p. 93 |
4.7 Initializing and Accessing Timer Registers | p. 95 |
4.7.1 Reading a Timer "on the Fly" | |
4.8 Short, Medium, and Long Intervals | p. 96 |
4.9 Producing Exact Frequencies | p. 102 |
4.9.1 Eliminating Round-off Errors | |
4.9.2 Compensating for Overhead Due to Instructions | |
4.10 8052 Timer 2 | p. 105 |
4.10.1 Auto-Reload Mode | |
4.10.2 Capture Mode | |
4.11 Baud Rate Generation | p. 106 |
Summary | p. 107 |
Problems | p. 107 |
5 Serial Port Operation | p. 111 |
5.1 Introduction | p. 111 |
5.2 Serial Communication | p. 111 |
5.3 Serial Port Buffer Register (SBUF) | p. 112 |
5.4 Serial Port Control Register (SCON) | p. 113 |
5.5 Modes of Operation | p. 113 |
5.5.1 8-Bit Shift Register (Mode 0) | |
5.5.2 8-Bit UART with Variable Baud Rate (Mode 1) | |
5.5.3 9-Bit UART with Fixed Baud Rate (Mode 2) | |
5.5.4 9-Bit UART with Variable Baud Rate (Mode 3) | |
5.6 Full Duplex Serial Communication: Issues | p. 117 |
5.7 Initialization and Accessing Serial Port Registers | p. 118 |
5.7.1 Receiver Enable | |
5.7.2 The Ninth Data Bit | |
5.7.3 Adding a Parity Bit | |
5.7.4 Interrupt Flags | |
5.8 Multiprocessor Communications | p. 119 |
5.9 Serial Port Baud Rates | p. 120 |
5.9.1 Using Timer 1 as the Baud Rate Clock | |
Summary | p. 127 |
Problems | p. 128 |
6 Interrupts | p. 131 |
6.1 Introduction | p. 131 |
6.2 8051 Interrupt Organization | p. 132 |
6.2.1 Enabling and Disabling Interrupts | |
6.2.2 Interrupt Priority | |
6.2.3 Polling Sequence | |
6.3 Processing Interrupts | p. 136 |
6.3.1 Interrupt Vectors | |
6.4 Program Design Using Interrupts | p. 137 |
6.4.1 Small Interrupt Service Routines | |
6.4.2 Large Interrupt Service Routines | |
6.5 Timer Interrupts | p. 139 |
6.6 Serial Port Interrupts | p. 142 |
6.7 External Interrupts | p. 143 |
6.8 Interrupt Timings | p. 148 |
Summary | p. 149 |
Problems | p. 150 |
7 Assembly Language Programming | p. 151 |
7.1 Introduction | p. 151 |
7.2 Assembler Operation | p. 152 |
7.2.1 Pass One | |
7.2.2 Pass Two | |
7.3 Assembly Language Program Format | p. 155 |
7.3.1 Label Field | |
7.3.2 Mnemonic Field | |
7.3.3 Operand Field | |
7.3.4 Comment Field | |
7.3.5 Special Assembler Symbols | |
7.3.6 Indirect Address | |
7.3.7 Immediate Data | |
7.3.8 Data Address | |
7.3.9 Bit Address | |
7.3.10 Code Address | |
7.3.11 Generic Jumps and Calls | |
7.4 Assemble-Time Expression Evaluation | p. 160 |
7.4.1 Number Bases | |
7.4.2 Character Strings | |
7.4.3 Arithmetic Operators | |
7.4.4 Logical Operators | |
7.4.5 Special Operators | |
7.4.6 Relational Operators | |
7.4.7 Expression Examples | |
7.4.8 Operator Precedence | |
7.5 Assembler Directives | p. 164 |
7.5.1 Assembler State Control | |
7.5.2 Symbol Definition | |
7.5.3 Storage Initialization/Reservation | |
7.5.4 Program Linkage | |
7.5.5 Segment Selection Directives | |
7.6 Assembler Controls | p. 173 |
7.7 Linker Operation | p. 173 |
7.8 Annotated Example: Linking Relocatable Segments and Modules | p. 176 |
7.8.1 ECHO.LST | |
7.8.2 IO.LST | |
7.8.3 Example.M51 | |
7.9 Macros | p. 183 |
7.9.1 Parameter Passing | |
7.9.2 Local Labels | |
7.9.3 Repeat Operations | |
7.9.4 Control Flow Operations | |
Summary | p. 188 |
Problems | p. 188 |
8 8051 C Programming | p. 191 |
8.1 Introduction | p. 191 |
8.2 Advantages and Disadvantages of 8051 C | p. 191 |
8.3 8051 C Compilers | p. 192 |
8.4 Data Types | p. 193 |
8.5 Memory Types and Models | p. 197 |
8.6 Arrays | p. 198 |
8.7 Structures | p. 199 |
8.8 Pointers | p. 199 |
8.8.1 A Pointer's Memory Type | |
8.8.2 Typed Pointers | |
8.8.3 Untyped Pointers | |
8.9 Functions | p. 202 |
8.9.1 Parameter Passing | |
8.9.2 Return Values | |
8.10 Some 8051 C Examples | p. 204 |
8.10.1 The First Program | |
8.10.2 Timers | |
8.10.3 Serial Port | |
8.10.4 Interrupts | |
Summary | p. 214 |
Problems | p. 214 |
9 Program Structure and Design | p. 217 |
9.1 Introduction | p. 217 |
9.2 Advantages and Disadvantages of Structured Programming | p. 219 |
9.3 The Three Structures | p. 220 |
9.3.1 Statements | |
9.3.2 The Loop Structure | |
9.3.3 The Choice Structure | |
9.4 Pseudo Code Syntax | p. 234 |
9.5 Assembly Language Programming Style | p. 237 |
9.5.1 Labels | |
9.5.2 Comments | |
9.5.3 Comment Blocks | |
9.5.4 Saving Registers on the Stack | |
9.5.5 The Use of Equates | |
9.5.6 The Use of Subroutines | |
9.5.7 Program Organization | |
9.6 8051 C Programming Style | p. 243 |
9.6.1 Comments | |
9.6.2 The Use of Defines | |
9.6.3 The Use of Functions | |
9.6.4 The Use of Arrays and Pointers | |
9.6.5 Program Organization | |
Summary | p. 245 |
Problems | p. 245 |
10 Tools and Techniques for Program Development | p. 247 |
10.1 Introduction | p. 247 |
10.2 The Development Cycle | p. 247 |
10.2.1 Software Development | |
10.2.2 Hardware Development | |
10.3 Integration and Verification | p. 251 |
10.3.1 Software Simulation | |
10.3.2 Hardware Emulation | |
10.3.3 Execution from RAM | |
10.3.4 Execution from EPROM | |
10.3.5 The Factory Mask Process | |
10.4 Commands and Environments | p. 255 |
Summary | p. 257 |
Problems | p. 257 |
11 Design and Interface Examples | p. 259 |
11.1 Introduction | p. 259 |
11.2 The SBC-51 | p. 259 |
11.3 Hexadecimal Keypad Interface | p. 265 |
11.4 Interface to Multiple 7-Segment LEDs | p. 267 |
11.5 Interface to Liquid Crystal Displays (LCDs) | p. 273 |
11.6 Loudspeaker Interface | p. 276 |
11.7 Nonvolatile RAM Interface | p. 277 |
11.8 Input/Output Expansion | p. 282 |
11.8.1 Using Shift Registers | |
11.8.2 Using the 8255 | |
11.9 RS232 (EIA-232) Serial Interface | p. 291 |
11.10 Centronics Parallel Interface | p. 294 |
11.11 Analog Output | p. 296 |
11.12 Analog Input | p. 300 |
11.13 Interface to Sensors | p. 303 |
11.14 Interface to Relays | p. 306 |
11.15 Stepper Motor Interface | p. 310 |
Summary | p. 315 |
Problems | p. 315 |
12 Design and Interface Examples in C | p. 319 |
12.1 Introduction | p. 319 |
12.2 Hexadecimal Keypad Interface | p. 319 |
12.3 Interface to Multiple 7-Segment LEDs | p. 323 |
12.4 Interface to Liquid Crystal Displays (LCDs) | p. 325 |
12.5 Loudspeaker Interface | p. 327 |
12.6 Nonvolatile RAM Interface | p. 329 |
12.7 Input/Output Expansion | p. 333 |
12.8 RS232 (EIA-232) Serial Interface | p. 337 |
12.9 Centronics Parallel Interface | p. 339 |
12.10 Analog Output | p. 341 |
12.11 Analog Input | p. 342 |
12.12 Interface to Sensors | p. 344 |
12.13 Interface to Relays | p. 346 |
12.14 Stepper Motor Interface | p. 347 |
Problems | p. 350 |
13 Example Student Projects | p. 353 |
13.1 Introduction | p. 353 |
13.2 Home Security System | p. 353 |
13.2.1 Project Description | |
13.2.2 System Specifications | |
13.2.3 System Design | |
13.2.4 Software Design | |
13.3 Elevator System | p. 355 |
13.3.1 Project Description | |
13.3.2 System Specifications | |
13.3.3 System Design | |
13.3.4 Software Design | |
13.4 Tic-Tac-Toe | p. 358 |
13.4.1 Project Description | |
13.4.2 System Specifications | |
13.4.3 Software Design | |
13.5 Calculator | p. 363 |
13.5.1 Project Description | |
13.5.2 System Specifications | |
13.5.3 Software Design | |
13.6 Micromouse | p. 366 |
13.6.1 Project Description | |
13.6.2 System Specifications | |
13.6.3 System Design | |
13.6.4 Software Design | |
13.7 A Soccer-Playing Robot | p. 369 |
13.7.1 Project Description | |
13.7.2 System Specifications | |
13.7.3 System Design | |
13.7.4 Software Design | |
13.8 A Smart Card Application | p. 371 |
13.8.1 Basic Security Concepts | |
13.8.2 Project Description | |
13.8.3 System Specifications | |
13.8.4 Software Design | |
Summary | p. 373 |
Problems | p. 374 |
14 8051 Derivatives | p. 377 |
14.1 Introduction | p. 377 |
14.2 MCS-151 and MCS-251 | p. 377 |
14.3 Microcontrollers with Flash Memory and NVRAM | p. 377 |
14.4 Microcontrollers with ADCs and DACs | p. 378 |
14.5 High-Speed Microcontrollers | p. 378 |
14.6 Network Microcontrollers | p. 379 |
14.7 Secure Microcontrollers | p. 379 |
Summary | p. 379 |
Problems | p. 380 |
Appendices | |
A Quick Reference Chart | p. 381 |
B Opcode Map | p. 383 |
C Instruction Definitions | p. 385 |
D Special Function Registers | p. 431 |
E 8051 Data Sheet | p. 439 |
F ASCII Code Chart | p. 455 |
G MON51-An 8051 Monitor Program | p. 457 |
H A Guide to Keil's [mu] Vision2 IDE | p. 499 |
I A Guide to the 8052 Simulator | p. 507 |
J The Advanced Encryption Standard | p. 515 |
K Sources of 8051 Development Products | p. 521 |
Bibliography | p. 527 |
Index | p. 529 |