1 of 14

A Presentation on �“Microcontroller”

By:

Dr. Shaikh Mohammed Suhel

Associate Professor & Head of Electrical Department

(R.N.G.P.I.T, Bardoli)

Ph.D. (SVNIT), M.Tech. (Industrial Electronics), GATE, B.E. Electrical

2 of 14

  • Architecture of 8051 Microcontroller

A

3 of 14

  • Architecture of 8051 Microcontroller
  • The 8051 microcontroller is an 8-bit microcontroller consisting of a CPU, memory units, I/O ports, timers, serial interface, interrupt system, and control circuitry, all interconnected through internal data and address buses.
  • 1. Central Processing Unit (CPU):
  • The CPU is the core of the 8051 and includes the Arithmetic Logic Unit (ALU), Accumulator, B register, Program Status Word (PSW), Program Counter (PC), and Data Pointer (DPTR).The ALU performs arithmetic and logical operations, while the PSW stores flag bits such as carry, auxiliary carry, and overflow.

A

4 of 14

  • 2. Memory Organization:
  • The 8051 has separate memory spaces for program memory (ROM) and data memory (RAM), indicating a Harvard architecture.
  • It contains 4 KB of on-chip ROM for program storage and 128 bytes of internal RAM, which is divided into register banks, bit-addressable memory, and general-purpose RAM.
  • Special Function Registers (SFRs) control the operation of peripherals like timers, serial port, and interrupts.

5 of 14

  • 2. Memory Organization (Internal RAM & ROM):

0000 H

0FFF H

R0

00 H

R1

01 H

R7

07 H

Register Bank 0

Register Bank 1

08 H

0F H

Register Bank 2

Register Bank 3

1F H

Bit AddressArea

20 H

2F H

00 H

7F H

General PurposeArea

30 H

7F H

8

E0*

A

8

F0*

B

8

B8*

IP

8

A8*

IE

8

89

TMOD

8

88*

TCON

8

8C

TH0

8

8A

TL0

8

8D

TH1

8

8B

TL1

8

98*

SCON

8

99

SBUF

8

87

PCON

8

D0*

PSW

8

81

SP

8

83

DPH

8

82

DPL

19

No Address

Program Counter

8

80*

P0

8

90*

P1

8

A0*

P2

8

B0*

P3

6 of 14

  • 3. Bus Structure:
  • The 8051 uses an 8-bit data bus and a 16-bit address-bus. The lower address and data lines are multiplexed and accessed through Port 0 with latches, while Port 2 provides the higher address lines during external memory access.

A

7 of 14

  • 4. Input / Output Ports:
  • The 8051 has four 8-bit I/O ports (Port 0 to Port 3) providing a total of 32 I/O lines.
  • Port 0: Multiplexed address/data bus (AD0–AD7)
  • Port 2: Higher address lines (A8–A15)
  • Port 3: Special function pins for interrupts, serial communication, and control signals.

A

8 of 14

5. Timers and Serial Interface

  • The microcontroller includes two 16-bit timers (Timer 0 and Timer 1) that can operate as timers or counters. The serial port supports full-duplex communication using TXD and RXD pins.

6. Interrupt and Control System

  • The 8051 supports multiple interrupt sources controlled through interrupt registers. The system control block handles timing, reset, clock generation using an external crystal oscillator, and memory control signals such as EA, ALE, and PSEN.

A

9 of 14

  • Pin Diagram

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

40

39

38

37

36

35

34

33

32

31

30

29

28

27

26

25

24

23

22

21

Vcc +5V

Ground

XTAL 2

XTAL 1

ALE

 

 

 

 

P1.0

P1.1

P1.2

P1.3

P1.4

P1.5

P1.6

P1.7

P0.0 AD0

P0.1 AD1

P0.2 AD2

P0.3 AD3

P0.4 AD4

P0.5 AD5

P0.6 AD6

P0.7 AD7

P2.7 A15

P2.6 A14

P2.5 A13

P2.4 A12

P2.3 A11

P2.2 A10

P2.1 A9

P2.0 A8

P3.0 RXD

P3.1 TXD

P3.4 T0

P3.5 T1

 

P3.6

P3.7

RST

10 of 14

  • The 8051 Oscillator and Clock
  • The oscillator and clock circuitry form the heart of the 8051 microcontroller.
  • All internal operations of the 8051 are synchronized by clock pulses generated by the oscillator.
  • The clock determines the speed of instruction execution.
  • 8051 microcontrollers are available with operating frequencies typically from: 1 MHz to 16 MHz (11.0592 MHz)
  • In 8051:1 Machine Cycle = 12 Oscillator Cycles.
  • Program instructions may require:1 machine cycle/2 machine cycles/4 machine cycles

11 of 14

  • The 8051 Oscillator and Clock

 

12 of 14

  • The Demultiplexing of Address and Data Bus

13 of 14

  • Reset (RST) Pin of 8051
  • A HIGH signal on RST for at least two machine cycles resets the microcontroller
  • Program execution stops, Program Counter (PC) is cleared to 0000H, SP=07H, Special Function Registers (SFRs) go to their default values, Ports are initialized to input mode
  • Power-On Reset Operation
  • Prevents random program execution at power-up and Ensures stable starting condition

14 of 14

  • PSW Register
  • CY (Carry): Set if carry is generated from MSB.
  • AC (Auxiliary Carry): Used in BCD arithmetic.
  • OV (Overflow): Set if signed arithmetic overflow occurs.
  • P (Parity): Set if accumulator has odd number of 1s.
  • RS1 & RS0: Select one of four register banks.
  • F0: General-purpose user flag.