Acknowledgments p. xi About the Author p. xii Introduction p. xiii The Intel 8051 p. xv Additional information and resources p. xvi Conventions used in this book p. xvii Microcontrollers p. 1 Different types of microcontrollers p. 2 Embedded microcontrollers p. 3 External memory microcontrollers p. 3 Processor architectures p. 5 Harvard versus Princeton p. 5 CISC versus RISC p. 8 Microcontroller memory types p. 9 Control storage p. 9 Variable area p. 15 Program counter stack p. 17 Hardware interface registers (I/O space) p. 19 Microcontroller features p. 21 Clocking p. 21 I/O pins p. 23 Interrupts p. 25 Timers p. 29 Peripherals p. 32 The 8051 p. 33 8051 Suppliers p. 34 8051 Processor Architecture p. 37 The CPU p. 37 8051 Addressing modes p. 44 External addressing p. 46 Interrupts p. 49 8051 instruction execution p. 50 8051 Instruction Set p. 53 Data movement instructions p. 54 Arithmetic instructions p. 61 Bit operators p. 71 Execution change operators p. 83 8051 Hardware Features p. 95 Device packaging p. 96 Chip technologies p. 102 Power considerations p. 104
Reset p. 106 System clock/oscillators p. 106 Parallel input/output p. 107 Level conversion p. 109 Timers p. 110 Interrupts p. 114 Serial I/O p. 116 RS-232 level conversion p. 120 Control store p. 122 External memory devices p. 123 Ordering information p. 126 Enhanced 8051 Features p. 127 8051 architecture enhancements p. 128 Intel MCS-151/251 p. 129 Dallas semiconductor high-speed microcontrollers p. 129 Control store and external memory p. 129 Resizing Dallas semiconductor HSM control store p. 130 Adding wait states to Dallas semiconductor HSM microcontrollers with external RAM p. 130 Scratchpad RAM enhancements p. 131 Timers p. 133 Dallas semiconductor HSM extensions p. 133 TIMER2 p. 134 Dallas semiconductor HSM watchdog timers p. 136 Serial I/O p. 139 Dallas semiconductor HSM's second serial port p. 139 Microwire p. 139 SPI p. 139 I2C p. 141 CAN p. 146 Analog I/O p. 148 Atmel AT89Cx051 voltage comparators p. 155 Applications Design p. 157 Power input p. 157 Reset p. 159 System oscillators/clocks p. 160 I/O pin interfacing p. 160 Interrupts p. 162 External RAM and ROM p. 165 8051 Programming p. 167 8051 programming p. 167 Dallas semiconductor DS87000 programmer p. 170
Atmel AT89Cx051 programming p. 170 PROG35: AT89Cx051 programmer circuit p. 173 Dallas semiconductor encrypted data microcontroller programming p. 178 Software p. 179 Development tools/environments p. 180 Assembly language p. 184 8051 assembly language programming styles p. 184 Interpreters p. 195 High-level languages p. 195 Intel hex format object files p. 197 8051 debugging hints p. 199 Experiments with the 8051 p. 203 Tools and parts required p. 204 PROG1: Setting up UMPS and getting a program to assemble p. 208 PROG2: Arithmetic operations p. 216 PROG3: Direct bank register addressing p. 221 PROG4: Indirect register bank addressing p. 225 PROG6: RAM direct addressing p. 227 PROG7: Bit addressing p. 229 PROG8: The DPTR pointer register and external memory p. 232 PROG5: Jumping around and control store pages p. 234 PROG9: Conditional branching p. 240 PROG10: Loop control p. 242 PROG11: Stack operations p. 243 PROG12: Stack arithmetic operations p. 245 PROG13: Subroutines p. 248 PROG14: Register parameter passing p. 249 PROG15: Stack parameter passing p. 252 PROG16: Implementing variable arrays p. 255 PROG17: Control store tables p. 258 PROG18: State machines p. 261 PROG1: Running a program in hardware p. 265 PROG19: Polling a button p. 267 PROG45: Inadvertently changing an I/O bit p. 268 PROG20: Button debouncing p. 270 PROG21: Christmas lights p. 273 PROG34: Oscillators p. 277 PROG34: Decoupling capacitors and power supplies p. 278 PROG22: Reset p. 279 PROG23: RAM contents on power up p. 281 PROG24: Timer interrupt with context saving p. 285
PROG25: Timer interrupts without context saving p. 287 PROG26: Button debouncing using interrupts and timer p. 288 PROG27: Memory-mapped I/O p. 293 PROG28: External memory p. 296 In closing p. 302 Emulators p. 303 Types of emulators p. 304 Monitor programs p. 307 PROG29: AT89Cx051 monitor/emulator using the DS87C520 p. 310 Real-Time Operating Systems p. 321 RTOS basics p. 322 PROG30: 8051 Example RTOS p. 326 PROG30: RTOSLITE p. 327 PROG31: FULLRTOS p. 336 LCD digital clock/thermometer using FULLRTOS p. 342 Example Applications p. 353 Marya's music box p. 354 PROG36: 51Bot--Getting the wheels turning p. 364 PROG37: 51Bot--Remote operation control with an infrared TV remote control p. 371 PROG41: 51Bot--RS-232 interface p. 376 PROG42: 51Bot--PWM motor control p. 380 51Bot: Embedded card p. 391 PROG33: Aircraft control demonstration p. 393 PROG39: Light sensors for robots p. 405 PROG38: Ultrasonic distance measuring p. 407 PROG49: NTSC composite video output p. 413 PROG47: Electronic RS-232 "breakout box" p. 421 Epilogue p. 431 Glossary p. 433 8051 Resources p. 445 Contacting the author p. 445 8051 suppliers p. 446 Part suppliers p. 447 Digi-Key p. 447 AP Circuits p. 447 Wirz Electronics p. 447 Tower Hobbies p. 448 JDR p. 448 Newark p. 448 Marshall Industries p. 449 Mondo-Tronics Robotics Store p. 449
Periodicals p. 449 Circuit Cellar Ink p. 449 Gernsback Publications p. 449 Microcontroller Journal p. 450 Nuts and Volts p. 450 Everyday Practical Electronics p. 450 Web resources p. 450 My favorite 8051 web sites p. 450 Some web sites of interest p. 451 Seattle Robotics Society p. 451 List of stamp applications (L.O.S.A.) p. 451 Adobe PDF viewers p. 451 Hardware FAQs p. 452 List servers p. 452 Consultants and product suppliers p. 455 Advanced Graphic Systems p. 456 Byte Craft Limited p. 457 CMX Company p. 457 Comtec p. 457 Display Electronics p. 458 Doss Development Corporation p. 458 Ibercomp S.A. p. 458 J and M Microtek, Inc. p. 459 Programmed Scientific Instruments, Inc. p. 459 Radix, Inc. p. 460 Signum Systems Corp. p. 460 Spectrum Engineering p. 460 Steward Electronics Ltd. p. 461 Systronix Inc. p. 461 TLA Microsystems Ltd. p. 461 Universal Solution Technology p. 462 WF Automacao Ind. Com. Serv. LTDA M.E. p. 462 16-Bit Operations p. 463 Declaring 16-bit variables p. 463 Incrementing and decrementing p. 465 Addition, subtraction, and bit operations p. 466 Multiplication p. 467 Division p. 469 Useful Routines p. 475 Timing delays p. 475 Table operations p. 479
LCD interfaces p. 480 12C bus master interface p. 487 "Bit banging" asynchronous serial interface p. 489 Hex to ASCII conversion p. 494 Sorting numbers p. 496 Loading the "encryption array" p. 502 Circular buffers p. 503 UMPS p. 505 SimmStick p. 509 Remote 8051 Debugger p. 515 The CD-ROM p. 519 PROG50: Ordering Raw Cards and Kits p. 523 Index p. 527 Table of Contents provided by Blackwell's Book Services and R.R. Bowker. Used with permission.