8051 Microcontroller (Internals, Instructions, Programming and Interfacing)

Book description

For every PC there are at least 20 embedded systems, and the number is increasing. 8051 is one of the most widely used microcontrollers in embedded system design, and its internal architecture, instruction set and interfacing techniques are presented in this book through simple language, excellent graphical annotations and a large variety of solved examples. Spread across 26 chapters, this book starts with the internal architecture of 8051, and then explains all instructions with examples of applications. In-depth discussions on interrupt-handling features are followed by the techniques of interfacing 8051 with the external world through different types of motors, relays, sensors, ADC/DACs, memory devices, keyboards, displays, etc.
As most of the embedded systems are battery-powered, power-saving schemes play a major role in considerations of these system designs. Hence, an entire chapter is devoted to explaining power management using 8051. One full-length design example explaining both hardware as well as software aspects of a home protection system using 8051 is presented as a case study. Discussions are concluded by a chapter on advanced microcontrollers such as the AVR.

Book Contents –
Introduction
1. Chapter Objectives
2. General Architecture
3. I/o Ports and Special Function Registers
4. Addressing Modes and Data Move Operations
5. Arithmetic Operations
6. Program Branching
7. Programming Examples-I
8. Subroutines And Stack
9. Logical Operations
10. Boolean Variable Manipulation
11. Programming Examples-II
12. Advanced Instructions
13. Programming Examples-III
14. External Interrupts
15. Timer/Counter Interrupts
16. Serial Communication and Serial Interrupts
17. Interfacing: External Memory
18. Interfacing: Keyboards
19. Interfacing:Display Devices
20. Interfacing: Dac/Adc
21. Interfacing: Dc Motor
22. Interfacing: Stepper Motor
23. Interfacing: Steppermotor
24. Power Management
25. Case Study: A Homeprotection System
26. Advanced Microcontrollers
Answers For Evaluate Yourself, Appendix A, Appendix B, Appendix C, Bibliography, Index

Table of contents

  1. Cover
  2. 8051 Microcontroller
  3. Copyright
  4. Contents (1/4)
  5. Contents (2/4)
  6. Contents (3/4)
  7. Contents (4/4)
  8. Preface
  9. Acknowledgements
  10. Introduction
  11. Chapter Objectives
    1. Introduction
    2. Microprocessor
      1. Microprocessor-Based System
    3. Microcontroller
      1. General Architecture
      2. Software Protection in Microcontrollers
      3. Brief History of Intel Microcontrollers
    4. MCS-51 Family
      1. Princeton and Harvard Architectures
      2. Comparison Between 8085 and MCS-51
    5. Power Management
    6. Microcontroller Packaging
      1. Plastic Dual-Inline Package
      2. Quad Flat Package
      3. Plastic-Leaded Chip Carrier
      4. Plastic Quad Flat Pack
      5. Thin Quad Flat Pack
    7. Future Trend
    8. Summary
    9. Points to Remember
    10. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  12. General Architecture
    1. External Features
    2. Pins and Signals
    3. Internal Architecture
    4. Program Memory Organization
      1. Pipeline Architecture
      2. Program Lock Bits
    5. Data Memory Organization
      1. Register Banks
      2. Bit-Addressable Area
      3. Scratch-Pad Area
    6. System Clock
    7. Reset
    8. Summary
    9. Points to Remember
    10. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  13. I/o Ports and Special Function Registers
    1. Introduction
    2. Sfr Map
    3. Sfr Functions
    4. Processor Status Word
      1. Comparison with 8085 Flags
    5. Accumulator
    6. Register B
    7. Stack Pointer
    8. Port Registers
      1. Comparing 8255 Ppi with MCS-51 Ports
      2. Architecture of Mcs-51 Ports
      3. Dc Characteristics of Mcs-51 Ports
    9. Power Management
    10. Solved Examples
    11. Summary
    12. Points to Remember
    13. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  14. Addressing Modes and Data Move Operations
    1. Instructions and Instruction Groups of Mcs-51
    2. Addressing Modes
      1. Immediate Addressing Mode
      2. Direct Addressing Mode
      3. Register Direct Addressing Mode
      4. Register Indirect Addressing Mode
    3. Data Transfer Mnemonics
    4. Forms of Mov Instruction
      1. 16-Bit Data Load
      2. 8-Bit Data Load
      3. Precautions in Hexadecimal Representations
      4. Format of Mov Instruction
      5. Comparison with 8085 Mnemonics
      6. Operand Expressions
      7. Restrictions in Addressing Modes
      8. Reading from I/o Ports
    5. Solved Examples
    6. Summary
    7. Points to Remember
    8. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  15. Arithmetic Operations
    1. Introduction
    2. Add Instruction
    3. Addc Instruction
    4. Subb Instruction
    5. Inc Instruction
    6. Dec Instruction
    7. Summary
    8. Points to Remember
    9. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  16. Program Branching
    1. Program Branching Instructions
    2. Unconditional Jumps
      1. Ljmp Instruction
      2. Ajmp Instruction
      3. Sjmp Instruction
      4. Application of Ajmp and Sjmp
    3. Conditional Branching
      1. Jz Instruction
      2. Jnz Instruction
      3. Cjne Instruction
      4. Djnz Instruction
      5. Labels in Program Listing
    4. Nop Instruction
    5. Solved Examples
    6. Summary
    7. Points to Remember
    8. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  17. Programming Examples-I
    1. Introduction
    2. Copy Block
    3. Shift Block
    4. Count No. of Nulls
    5. Find Checksum
    6. Sum of Natural Numbers
    7. Sum of a Series
    8. Fibonacci Series
    9. Generate a Series
    10. Summary
    11. Points to Remember
    12. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  18. Subroutines And Stack
    1. Need of Subroutines
    2. Lcall Instruction
    3. Ret Instruction
    4. Acall Instruction
    5. Mechanism of Subroutines
    6. Nesting of Subroutines
    7. Stack
    8. Push Instruction
    9. Pop Instruction
    10. Other Applications of Subroutine
    11. Comparison with 8085
    12. Solved Examples
    13. Parameter Passing in Subroutines
    14. Summary
    15. Points to Remember
    16. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  19. Logical Operations
    1. Chapter Objectives
      1. Introduction
      2. ANL Instruction
      3. ORL Instruction
      4. XRL Instruction
      5. CLR Instruction
      6. CPL Instruction
      7. RL Instruction
      8. RLC Instruction
      9. RR Instruction
      10. RRC Instruction
      11. Solved Examples
      12. Summary
      13. Points t o Remember
      14. Review Questions
        1. Evaluate Yourself
        2. Search for Answers
        3. Think and Solve
  20. Boolean Variable Manipulation
    1. Introduction
      1. Source and Destination of Boolean Operations
    2. Boolean Data Loading and Movement
      1. Clr Instruction
      2. Setb Instruction
      3. Mov Instruction
    3. Bit-Oriented Program Branching
      1. Jc Instruction
      2. Jnc Instruction
      3. Jb Instruction
      4. Jnb Instruction
    4. Bit-Oriented Logical Operations
      1. Anl Instruction
      2. Orl Instruction
      3. Cpl Instruction
    5. Solved Examples
    6. Summary
    7. Points to Remember
    8. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  21. Programming Examples-II
    1. Introduction
    2. Count 1s in a Byte
    3. Unpack a Bcd Number
    4. Pack Bcd Digits
    5. Pack Array of Unpacked Bcd Digits
    6. Find Largest and Smallest Integers of an Array
    7. Bubble Sorting
    8. Find the Sum of Factorials
    9. Sort Out Numbers Divisible by 4
    10. Summary
    11. Points to Remember
    12. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  22. Advanced Instructions
    1. Introduction
    2. Movc Instruction
    3. Movx Instruction
    4. Xch Instruction
    5. Xchd Instruction
    6. Mul Instruction
    7. Div Instruction
    8. Da a Instruction
    9. Jmp Instruction
    10. Swap Instruction
    11. JBC Instruction
    12. Reti Instruction
    13. Solved Examples
    14. Summary
    15. Points to Remember
    16. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  23. Programming Examples-III
    1. Compare with External Array
    2. Find Sum of a Series
    3. Reverse an Array
    4. Hex to Bcd Conversion
    5. Update Clock Display
    6. Display Shift for Right Entry
    7. Count Number of Words
    8. Generate Prime Numbers
    9. Summary
    10. Points to Remember
    11. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  24. External Interrupts
    1. Introduction
      1. What is an Interrupt?
      2. Vectored Interrupt
    2. External Interrupts of 8051
    3. Sfrs for External Interrupt
      1. Tcon
      2. Ie
    4. Interrupt Service Routine
      1. Checklist for Into
      2. Checklist for Int1
    5. Software Interrupts
    6. Benefits of Interrupt
    7. Solved Examples
    8. Summary
    9. Points to Remember
    10. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  25. Timer/Counter Interrupts
    1. Purpose of a Timer
      1. Differences Between a Timer and a Counter
    2. 8051/52 Timers
  26. Serial Communication and Serial Interrupts
    1. Introduction
      1. Serial and Parallel Communications
      2. Simplex, Full-Duplex and Half-Duplex Communications
      3. Synchronous and Asynchronous Communications
    2. Overview of Serial Communication
      1. How Serial Communication Works
      2. Serial Data Format
      3. Baud Rate
    3. Serial Communication Sfrs
      1. Sbuf
      2. Scon
      3. Pcon
    4. Modes of Serial Communication
      1. Mode 0
      2. Mode 1
      3. Mode 2
      4. Mode 3
    5. Serial Communication Issues
      1. Multiprocessor Communication
      2. Role of Timer in Baud-Rate Generation
      3. Why 11.0592 MHz?
      4. Initiation of Data Transmission and Reception
      5. Signal Boosting for Long Distance Transmission
    6. Serial Communication Routines
      1. Initialization Steps for Serial Communication
      2. Serial Communication Interrupt Service Routine
    7. Solved Examples
    8. Summary
    9. Points to Remember
    10. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  27. Interfacing: External Memory
    1. Introduction
      1. Need of External Memory
    2. Interfacing Signals
    3. Program Memory Interfacing
    4. Data Memory Interfacing
    5. Software Security Features
      1. One Lock Bit
      2. Two Lock Bits
      3. Three Lock Bits
    6. Solved Example
    7. Summary
    8. Points to Remember
    9. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  28. Interfacing: Keyboards
    1. Introduction
    2. Contact Type Keys
    3. Interfacing a Key
    4. Solved Example
      1. Example 18.1
    5. Bouncing of Keys
      1. Hardware Debouncing
      2. Software Debouncing
    6. Key Matrix
    7. Scanning Keyboard Matrix
    8. Debouncing Keyboard Matrix
    9. Summary
    10. Points to Remember
    11. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  29. Interfacing:Display Devices
    1. Introduction
    2. Led Interfacing
    3. Solved Examples
    4. Seven-Segment Display Interfacing
    5. Multiplexed Display
    6. Multiplexed Keyboard Display Interface
    7. Summary
    8. Points to Remember
    9. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  30. Interfacing: Dac/Adc
    1. Introduction
      1. How a Dac Works
      2. How an Adc Works
      3. Sample and Hold
    2. Interfacing Dac
    3. Interfacing Adc
    4. Solved Examples
    5. Summary
    6. Points to Remember
    7. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  31. Interfacing: Dc Motor
    1. Introduction
      1. How Dc Motor Works
    2. Direction Control
      1. H-Bridge
      2. H-Bridge Using Transistors
      3. L293D
    3. Speed Control
      1. Through Dac
      2. Changing Duty Cycle of Square Wave
    4. Relay and Optocoupler
    5. Solved Examples
    6. Summary
    7. Points to Remember
    8. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  32. Interfacing: Stepper Motor
    1. Introduction
    2. How Stepper Motor Functions
      1. Full-Step Rotation
      2. How Step Angle is Controlled
      3. Generation of 3.6° Step Angle
      4. Generation of Half-Step
    3. Stepper Motor Interfacing
      1. Using Transistors
      2. Using Dedicated Ics
    4. Direction Control
    5. Speed Control
    6. Solved Examples
    7. Summary
    8. Points to Remember
    9. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  33. Interfacing: Steppermotor
    1. Introduction
    2. How a Servomotor Works
    3. Inside a Servo
    4. Controlling Direction of Rotation
      1. For Pulses of 2 Milliseconds
      2. For Pulses of 1 Millisecond
      3. For Pulses of 1.5 Milliseconds
    5. Interfacing a Servomotor
    6. Home-Position Detection
    7. Solved Example
    8. Summary
    9. Points to Remember
    10. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  34. Power Management
    1. Introduction
    2. Power-Saving Modes
      1. Idle Mode
      2. Exit from Idle Mode
      3. Power-Down Mode
      4. Exit from Power-Down Mode
      5. Diff erence Between Idle and Power-Down Modes
      6. Distinguishing Cold Start and Warm Start
    3. A Case Study on Power Management
      1. Case 1: Normal Design Without Power Management
      2. Case 2: Power Management Using Idle Mode
      3. Case 3: Power Management Using Power-Down Mode
      4. Comparison of Performance in Three Cases
      5. Further Improvements
    4. Summary
    5. Points to Remember
    6. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  35. Case Study: A Homeprotection System
    1. Initial Planning
      1. What is Home Protection System?
      2. Sensor Selection
      3. Overall System
      4. Software Modules
    2. Hardware Realization
      1. Display Drivers
      2. Key Return Lines and External Pull-Ups
      3. System Reset and Crystal
      4. Audio Interfacing
      5. Sensor Interfacing
      6. Power Supply
    3. Software Development
      1. Ir-Sensing Module
      2. External Interrupts’ Routines
      3. Timer 0 Interrupt Service Routine
      4. Timer 1 Interrupt Service Routine
      5. Key Scanning
      6. Display Refreshing
      7. Main Loop
      8. Reset Initialization
    4. Software Listing
    5. Summary
    6. Points to Remember
    7. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  36. Advanced Microcontrollers
    1. Introduction
    2. Avr Microcontrollers
      1. Important Features
      2. Pins and Signals
      3. External Reset and Crystal Inputs
      4. Operating Voltages and Power Consumption
      5. Internal Architecture
      6. Program Memory
      7. Data Memory
      8. Status Register
      9. Stack and Stack Pointer
      10. Power Management and Sleep Modes
      11. System Reset
      12. Watchdog Timer
      13. Atmega8 Instruction Set
      14. Comparison Between Atmega8 and Atmega16
      15. Jtag Interface
    3. Mcs-96 Microcontrollers
      1. Important Features
      2. Pins and Signals
      3. Internal Architecture
      4. Memory Map
      5. Addressing Modes
      6. Instruction Set
    4. Arm Microcontrollers
      1. ARM Core Architecture
      2. Versions of ARM
      3. Important Features
      4. Intelligent Energy Manager (IEM)
      5. Renesas Microcontrollers
    5. Summary
    6. Points to Remember
    7. Review Questions
      1. Evaluate Yourself
      2. Search for Answers
      3. Think and Solve
  37. Answers For Evaluate Yourself
  38. Appendix A
    1. Mcs-51 Instruction Set
    2. Instructions Arranged by Functional Order
      1. Arithmetic Operations
      2. Logical Operations
      3. Data Movement Operation
      4. Boolean Variable Operations
      5. Call and Jump Operations
    3. Instructions Arranged by their Opcodes (1/2)
    4. Instructions Arranged by their Opcodes (2/2)
    5. Instructions Arranged by Alphabetical Order
    6. Instructions Arranged by Operand Types
      1. Instructions with Bit Operands
      2. Instructions with Direct Addressing
      3. Instructions with Indirect Addressing Through Ro
      4. Instructions with Indirect Addressing Through R1
      5. Instructions with Register Addressing Through Ro
      6. Instructions with Register Addressing Through R1
      7. Instructions with Register Addressing Through R2
      8. Instructions with Register Addressing Through R3
      9. Instructions with Register Addressing Through R4
      10. Instructions with Register Addressing Through R5
      11. Instructions with Register Addressing Through R6
      12. Instructions with Register Addressing Through R7
      13. Instructions with Register Addressing Through the Accumulator
  39. Appendix B
    1. 8051 Programs Using C
  40. Appendix C
    1. Mcs®-51 Programmer’s Guide and Instruction Setinstruction Definitions
  41. Bibliography
  42. Index (1/7)
  43. Index (2/7)
  44. Index (3/7)
  45. Index (4/7)
  46. Index (5/7)
  47. Index (6/7)
  48. Index (7/7)

Product information

  • Title: 8051 Microcontroller (Internals, Instructions, Programming and Interfacing)
  • Author(s): Subrata Ghosal
  • Release date: May 2024
  • Publisher(s): Pearson India
  • ISBN: 9781282655034