Sei sulla pagina 1di 58

8051 Microcontroller

1
Block Diagram of a Microprocessor

2
Block Diagram of a Microcontroller

3
Comparison between MP & MC

4
Features of 8051
• 4 KB on chip program memory
• 128 bytes on chip data memory (RAM)
• 4 register banks
• 32 general purpose registers each of 8 bits
• Bit as well as byte addressable RAM area of 16 bytes
• 8-bit data bus
• 16-bit address bus
• 16-bit program counter and data pointer
• 16 bit timers (usually 2, but may have more, or less)
• 3 internal and 2 external interrupts
• Four 8-bit ports, (short models have two 8-bit ports)
• 1 Microsecond instruction cycle with 12 MHz Crystal
5
8051 Pin Diagram

6
Block Diagram

7
8051 Programming Model

8
Oscillator Circuit & Timing

9
PSW

10
Internal RAM

11
Stack Operation

12
Special Function Registers

13
Special Function Registers

14
SFR Bit Address

15
I/O Ports

16
Port Pin Circuits

17
Port 3

18
External Memory Connection

19
External Memory Access

20
External Memory Timing

21
TCON Register

22
TMOD Register

23
Timer/Counter Control Logic

24
Timer 1 & Timer 0 Operation Modes

25
SCON Register

26
PCON Register

27
Shift Register Mode 0 Timing

28
Mode 1 Standard UART

29
Mode 1 Baud Rates

30
Mode 2 Baud Rate

31
Mode 3

• Mode 3 is Identical to Mode 2 except Baud


Rate
• Mode 3 Baud Rate is same as Mode 1

32
Interrupts
• Timer Flag Interrupts
• Serial Port Interrupt
• External Interrupts

33
IE Register

34
IP Register

35
Interrupt Priority

36
Interrupt Addresses

37
RESET

38
Moving Data
• MOV destination, source
• PUSH source or POP destination
• XCH destination, source
Addressing modes
• Immediate Addressing mode
• Register Addressing mode
• Direct Addressing mode
• Indirect Addressing mode
39
Memory parts

• Internal RAM
• Internal Special function registers
• External RAM
• Internal and External ROM

40
Opcodes
• MOV
• MOVX
• MOVC
• PUSH and POP
• XCH

41
Example Instructions

• MOV Rr, #n
• MOV A, Rr
• MOV A, address
• MOV @Rp, #n
• MOVX A, @Rp
• MOVC A, @A+DPTR

42
Logical Operations

43
Byte Level Logical Operations

44
Internal RAM Bit Addresses

45
SFR Bit Addresses

46
Bit-Level Boolean Operations

47
Rotate and Swap Operations

48
Arithmetic Operations

• INC destination
• DEC destination
• ADD/ADDC destination, source
• SUBB destination, source
• MUL AB
• DIV AB
• DA A

49
Instructions Affecting Flags

50
Jump & Call Instructions

51
Jump Instruction Ranges

52
Jump and Call Program Ranges

• Relative Range
• Short Absolute Range
• Long Absolute Range

53
Bit Jumps

54
Byte Jumps

55
Byte Jumps

56
Unconditional Jumps

57
Calls and Subroutines

58

Potrebbero piacerti anche