|
CHAPTER 1: INTRODUCTION TO 8052 MICROCONTROLLER
-
1.1 What is a Microcontroller?
1.1.1 Microcontroller Program Storage
1.1.2 "Loading" a Microcontroller Program
1.2 What is an 8051 or 8052?
1.2.1 Derivative Chips
1.3 Using Windows or Linux
CHAPTER 2: TYPES OF MEMORY
-
2.1 Code Memory
2.1.1 Memory Architecture
2.2 External RAM
2.3 On-Chip Memory
2.3.1 Internal RAM
2.3.2 Special Function Register (SFR) Memory
CHAPTER 3: SPECIAL FUNCTION REGISTERS (SFRs)
-
3.1 Referencing SFRs
3.2 Referencing Bits of SFRs
3.3 Bit-Addressable SFRs
3.4 SFR Types
3.5 SFR Descriptions
3.6 Other SFRs for Derivative Chips
CHAPTER 4: BASIC REGISTERS
-
4.1 Accumulator
4.2 "R" registers
4.3 "B" Register
4.4 Program Counter (PC)
4.5 Data Pointer (DPTR)
4.6 Stack Pointer (SP)
CHAPTER 5: ADDRESSING MODES
-
5.1 Immediate Addressing
5.2 Direct Addressing
5.3 Indirect Addressing
5.4 External Direct
5.5 External Indirect
5.4 External Direct
5.5 External Indirect
5.6 Code Indirect
CHAPTER 6: PROGRAM FLOW
-
6.1 Conditional Branching
6.2 Direct Jumps
6.3 Direct Calls
6.4 Returns from Routines
6.5 Interrupts
CHAPTER 7: INTERNAL TIMING
CHAPTER 8: TIMERS
-
8.1 How does a timer count?
8.2 Using Timers to Measure Time
8.2.1 How long does a timer take to count?
8.2.2 Timer SFRs
8.2.3 Timer Mode (TMOD) SFR
8.2.4 Timer Control (TCON) SFR
8.2.5 Initializing a Timer
8.2.6 Reading the Timer
8.2.7 Timing the length of events
8.3 Using Timers as Event Counters
8.4 Using Timer 2
8.4.1 Timer 2 Control (T2CON) SFR
8.4.2 Timer 2 in Auto-Reload Mode
8.4.3 Timer 2 in Capture Mode
8.4.4 Timer 2 as a Baud Rate Generator
CHAPTER 9: SERIAL COMMUNICATION
- 9.1 Serial Control SFR (SCON)
9.1.1 Serial Mode 0: 8-bit Shift Register, Oscillator-based Baud Rate
9.1.2 Serial Mode 1: 8-bit UART, Timer-based Baud Rate
9.1.3 Serial Mode 2: 9-bit UART, Oscillator-based Baud Rate
9.1.3 Serial Mode 2: 9-bit UART, Oscillator-based Baud Rate
9.1.4 Serial Mode 3: 9-bit UART, Timer-based Baud Rate
9.2 Configuring the Serial Port
9.3 Setting the Serial Port Baud Rate
9.4 Writing to the Serial Port
9.5 Reading the Serial Port
9.6 Using Timer 2 for Serial Port Baud Rate
9.7 Serial Communication Sample Program
CHAPTER 10: INTERRUPTS
-
10.1 Events that can Trigger Interrupts
10.2 Configuring Interrupts
10.3 Polling Sequence
10.4 Interrupt Priorities
10.5 Interrupt Triggering
10.6 Exiting Interrupt
10.7 Specific Interrupt Types
10.7.1 Timer 0 and Timer 1 Interrupts
10.7.2 External 0 and External 1 Interrupts
10.7.3 Serial Interrupts
10.7.4 Timer 2 Interrupts
10.8 Register Protection
10.9 Locating Large ISRs in Memory
10.10 Common Problems with Interrupts
10.11 Functional Interrupt Example
ASSEMBLY LANGUAGE
CHAPTER 11: 8052 ASSEMBLY LANGUAGE
-
11.1 Syntax
11.2 Number Bases
11.3 Expressions
11.4 Operator Precedence
11.5 Characters and Character Strings
11.6 Assembly Language Directives
11.6.1 Setting the Address of Program Assembly (ORG)
11.6.2 Establishing Symbol Equates (EQU)
11.6.3 Inserting 8-bit Data In Program (DB)
11.6.4 Inserting 16-bit Data In Program (DW)
11.7 Changing Program Flow (LJMP, SJMP, AJMP)
11.8 Subroutines (LCALL, ACALL, RET)
11.9 Register Assignment (MOV)
11.10 Incrementing and Decrementing Registers (INC/ DEC)
11.11 Program Loops (DJNZ)
11.11.1 DJNZ With More Than 256 Repetitions
11.12 Setting, Clearing, and Moving Bits (SETB/CLR/CPL/MOV)
11.13 Bit-Based Decisions & Branching (JB, JBC, JNB, JC, JNC)
11.14 Value Comparison (CJNE)
11.15 Less Than and Greater Than Comparison (CJNE)
11.16 Zero and Non-Zero Decisions (JZ/JNZ)
11.17 Performing Additions (ADD, ADDC)
11.18 Performing Subtractions (SUBB)
11.19 Performing Multiplication (MUL)
11.20 Performing Division (DIV)
11.21 Shifting Bits (RR, RRC, RL, RLC)
11.21 Shifting Bits (RR, RRC, RL, RLC)
11.22 Bit-wise Logical Instructions (ANL, ORL, XRL)
11.23 Exchanging Register Values (XCH)
11.24 Swapping Accumulator Nibbles (SWAP)
11.25 Exchanging Nibbles Between Accumulator and Internal RAM (XCHD)
11.26 Adjusting Accumulator for BCD Addition (DA)
11.27 Using the Stack (PUSH/POP)
11.28 Setting the Data Pointer DPTR (MOV DPTR)
11.29 Reading External RAM/Data Memory (MOVX)
11.30 Reading Code Memory/Tables (MOVC)
11.31 Using Jump Tables (JMP @A+DPTR)
CHAPTER 12: 16-BIT MATHEMATICS WITH THE 8052
-
12.1 How did we learn math in primary school?
12.2 16-bit Addition
12.3 16-bit Subtraction
12.4 16-bit Multiplication
12.5 16-bit Division
8052 HARDWARE & SINGLE BOARD COMPUTER
CHAPTER 13: 8052 MICROCONTROLLER PIN FUNCTIONS
-
13.1 I/O Ports (P0, P1, P2, P3)
13.1.1 Port 0
13.1.2 Port 1
13.1.3 Port 2
13.1.4 Port 3
13.2 Oscillator Inputs (XTAL1, XTAL2)
13.3 Reset Line (RST)
13.4 Address Latch Enable (ALE)
13.5 Program Store Enable (-PSEN)
13.6 External Access (-EA)
-
14.1 Features of the 8052.com SBC
14.2 SBC Schematic
14.2.1 Microcontroller: Atmel AT89S8252, Dallas 89C420, or 8052 (U1)
14.2.2 Latch: 74LS573 (U2)
14.2.3 Address Decoder: 74LS138 (U5)
14.2.4 EPROM Code Memory: 27C256 (U3)
14.2.5 Static RAM: 62256 (U4)
14.2.6 LCD: Memory-Mapped (J3) and Direct Connect (J4)
14.2.7 Keypad Connector (J5)
14.2.8 DS1307 Real Time Clock (U13)
14.2.9 AT25010A Serial EEPROM (U14)
14.2.10 Reset Circuit: RC Network, MN13811 Reset Supervisor, and Manual Reset
14.2.11 RS-232 Transceiver: MAX232
14.2.12 Power Connector, Rectification, and Voltage Regulator
14.2.13 In-System Programming (J2, J6, U11, U12)
14.2.14 Port Connections (J7 – J10)
14.2.15 Power, Ground, and other Signal Connections (J11)
14.2.16 Latched Low Byte of Address Bus (J12)
14.2.17 Power Jumper (JP7)
14.2.18 Other Connections
DEVELOPMENT TOOLS
CHAPTER 15: SOFTWARE DEVELOPMENT TOOLS
-
15.1 Introduction to Pinnacle 52 Integrated Development Environment
15.2 Pinnacle 52 Environment Overview
15.3 Creating, Loading, and Saving Editor Files
15.4 Assembling a Program
15.5 Loading a Program for Simulation
15.6 Simulating a Program in Pinnacle 52
15.6.1 Pinnacle's View of Registers and SFRs
15.6.2 Execute Menu
15.6.3 Simulator Menu
15.7 Concept of Projects in Pinnacle 52
15.7.1 Creating Projects
15.7.2 Editing Projects
15.7.3 Building Projects
15.7.4 Project Options
15.8 Relocatable Code in Pinnacle 52
15.8.1 The Problem of Absolute Code in Multiple Source Files
15.8.2 Relocatable Segments
15.8.3 Initialization and Interrupt Vectors with Relocatable Code
15.8.4 When to Use Relocatable Segments
15.9 Multiple Source Files in Pinnacle 52
CHAPTER 16: HARDWARE DEVELOPMENT TOOLS
-
16.1 Device Programmers
16.1.1 Using a Device Programmer
16.2 In-System Programming
16.2.1 Using In-System Programming
16.3 In-Circuit Emulation
16.3.1 Using ICE Within a Circuit
HARDWARE INTERFACE AND SOFTWARE EXAMPLES
CHAPTER 17: SBCMON MONITOR SOFTWARE
-
17.1 Installing SBCMON
17.1.1 Configuring the PC Terminal Program
17.2 Powering up SBCMON
17.3 SBCMON Main Menu
17.3.1 Command 'A': Mini-Assembler
17.3.2 Command 'C': Read/Set Real Time Clock
17.3.3 Command 'E': Read/Write Serial EEPROM
17.3.4 Command 'I': Read/Write to Internal RAM
17.3.5 Command 'K': Keypad Test
17.3.6 Command 'L': Load HEX File into SBC Memory
17.3.7 Command 'M': Set LCD Access Mode
17.3.8 Command 'Q': Quick HEX Load and Run
17.3.9 Command 'R': Run (Execute) Code at Specific Address
17.3.10 Command 'V': Verify External RAM
17.3.11 Command 'W': Write Text to LCD
17.3.12 Command 'w': Write Commands to LCD
17.3.13 Command 'X': Read/Write to External RAM
17.4 Writing Programs that Execute in SBCMON
17.4.1 Using SBCMON Library Routines in External Programs
17.4.2 Using Interrupts in External Programs with SBCMON
17.4.3 Using Timers in SBCMON
CHAPTER 18: INTERFACING TO 4x4 KEYPAD
-
18.1 Direct Connection of Keypad
18.2 Memory-Mapped Connection of Keypad
18.2.1 Reading and Debouncing Keypad
CHAPTER 19: INTERFACING TO LCD
-
19.1 LCD Electrical Connections
19.2 Direct 8-bit Connection to LCD
19.2.1 Controlling the LCD's EN Line
19.2.2 Checking the LCD's Busy Status
19.2.3 Initializing the LCD
19.2.4 Clearing the LCD Screen
19.2.5 Writing Text to the LCD
19.2.6 An LCD "Hello World" Program
19.2.7 LCD Cursor Positioning
19.3 Direct 4-bit Connection to LCD
19.3.1 Writing a byte to LCD in 4-bit mode
19.3.2 Reading a byte from LCD in 4-bit mode
19.4 Memory-Mapped Connection to LCD
19.4.1 Electrical Connection of Memory-Mapped LCD
19.4.2 Writing to the LCD in Memory-Mapped Mode
19.4.3 Reading from the LCD in Memory-Mapped Mode
19.4.4 Additional Notes about Memory-Mapped LCD
CHAPTER 20: INTERFACING TO SERIAL EEPROM (SPI)
-
20.1 General Information about Serial Peripheral Interface (SPI)
20.1.1 Coding for SPI Communication
20.1.2 Additional Information about SPI Communication
20.2 Software Communication with AT25010A
20.2.1 AT25010A Command: Write Byte (WR)
20.2.2 AT25010A Command: Read Byte (RD)
20.2.3 AT25010A Command: Set Write Enable Latch (WREN)
20.2.4 AT25010A Command: Read Status Register (RDSR)
CHAPTER 21: INTERFACING TO REAL TIME CLOCK (I2C)
-
21.1 General Information about Inter-IC (I2C) Protocol
21.1.1 Coding for I2C Communication
21.2 I2C Communication with the DS1307
21.2.1 Sending Data to DS1307
21.2.2 Receiving Data from the DS1307
21.2.3 DS1307 Registers
21.3 Software Communication with DS1307
21.3.1 Setting the DS1307 Clock
21.3.2 Reading the DS1307 Clock
CHAPTER 22: ADDITIONAL SOFTWARE TOICS
-
22.1 Reading the Value of the Program Counter
22.2 Power Saving Modes
22.2.1 Idle Mode
22.2.2 Power-Down Mode
22.3 Software-Based Real-Time Clock
22.3.1 RTC Variables
22.3.1 Crystal Frequency
22.3.2 Calculating Timer 0 Overflow Frequency
22.3.3 Starting Timer 0
22.3.4 Configure Timer 0 Interrupt
22.3.5 Writing the Timer 0 Interrupt Service Routine
22.3.6 Additional Comments about the RTC
REFERENCE & APPENDIXES
Appendix A: 8052 Instruction Set Quick-Reference
Appendix B: 8052 Instruction Set
Appendix C: SFR Quick Reference
Appendix D: SFR Detailed Reference (Alphabetical)
Bibliography
Index