8051 Microcontroller Part 1

21

Transcript of 8051 Microcontroller Part 1

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 1/21

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 2/21

Outlines Introduction

µP vs µC

 Architecture Operation

Registers

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 3/21

Introduction  A microcontroller is a microprocessor specifically designed

for control applications.

The microcontroller has the CPU, RAM, ROM,timer/counter, parallel and serial ports and interruptcircuits fabricated into a single IC chip using VLSItechnology. It is often called “ a computer on a chip”. 

The microcontroller is most efficiently used in systems that

has a fixed program for a dedicated application. Eg; in akeyboard, microwave oven, ATM, automobile engines andso on. Very often the terms embedded processor andmicrocontroller are used interchangeably.

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 4/21

Microprocessor v/s Microcontroller Microprocessors are intended to be general-purpose

digital computers whereas microcontrollers areintended to be special purpose digital controllers.

Microprocessors contain a CPU, memory addressingcircuits, and interrupt handling circuits whereasmicrocontrollers have these features as well as timers,

parallel and serial I/O ports, and internal RAM andROM.

Microprocessors few pins are multiplexed whereas inmicrocontrollers most of the pins have dual functions.

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 5/21

Microprocessor v/s Microcontroller Microprocessor has high RAM to ROM ratio whereas

microcontroller has high ROM to RAM ratio.

Microprocessor has one or two types of bit handlinginstructions whereas microcontroller has many.

Microprocessor cannot function as a computer withoutaddition of many external parts whereas

microcontroller can function as a computer with outaddition of any external parts.

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 6/21

Features 8-bit CPU optimized for control applications

Extensive Boolean processing (single-bit logic) capabilities

64K Program Memory address space

64K Data Memory address space Up to 4K bytes of on-chip Program Memory

128 bytes of on-chip Data RAM

32 bi-directional and individually addressable I/O lines

Two 16-bit timer/counters

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 7/21

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 8/21

 

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

30

29

28

27

26

25

24

23

22

21

31

P1.0

P1.1

P1.2

P1.3

P1.4

P1.5

P1.6

RST

(RXD) P3.0

(TXD) P3.1

(INT0) P3.2

(INT1) P3.3

(T0) P3.4

(T1) P3.5

(WR) P3.6

XTAL 2

XTAL 1

GND

Vcc

P0.0(AD0)

P2.0(A8)

P2.1(A9)

P2.2(A10)

P2.3(A11)

P2.4(A12)

P2.5(A13)

P2.6(A14)

P2.7(A15)

PSEN

 ALE/PROG

EA/VPP

P0.6(AD6)

P0.7(AD7)

P0.5(AD5)

P0.4(AD4)

P0.3(AD3)

P0.2(AD2)

P0.1(AD1)

(RD) P3.7

P1.7

(Serial)

interrupt

Timer 

Ex M W/R

clock

Ext

Memory

 Address

Ext Memory

 Access Control

Ext Memory

 Address

8051

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 9/21

 

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 10/21

 

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 11/21

Registers of the 8051

Microcontroller 8-bit registers ------------------ = 34

16-bit registers ----------------- = 2 (PC and DPTR)

Stack size ----------------------- = 128 Byte

Internal ROM ------------------ = 4KB Internal RAM ----------------- = 128 Byte

SFRs (RAM) -------------------- = 128 Byte

Flags ---------------------------- = 4

Timers -------------------------- = Two 16-bit Parallel ports ------------------- = Four 8-bit (P0-P3)

Serial port ---------------------- = 1

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 12/21

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 13/21

A & B Registers The 8051 contains 34 general-purpose or working

registers. Two of these registers A and B hold results ofarithmetic and logical operations of the 8051 CPU.

The register A is also used for all data transfersbetween the 8051 and any external memory.

The register B is used with the A register formultiplication and division operations. The

instruction MUL AB, multiplies the 8-bit unsigned values in A and B and leave the result in A (low byte)and B (high byte). The instruction DIV AB, divides Aby B leaving quotient in A and remainder in B.

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 14/21

The other 32 registers are arranged as a part of internalRAM in four banks, bank0 to bank3. The registers within each bank are labeled R0 through R7. The bankthat is presently in use (active) is defined by thesetting of two “ bank select bits” in the PSW. 

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 15/21

Memory Organization

Logical separation of data and program memory Separate address spaces for Program (ROM) and Data (RAM)

Memory

 Allow Data Memory to be accessed by 8-bit addresses quicklyand manipulated by 8-bit CPU

Data Memory RAM Includes 128 bytes of on-chip Data Memory which are more

easily accessible directly by its instructions

There is also a number of Special Function Registers (SFRs)

Internal Data Memory contains four banks of eight registersand a special 32-byte long segment which is bit addressableby 8051 bit-instructions

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 16/21

Memory Organization - RAM

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 17/21

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 18/21

Memory Organization - RAM

Bit-addressable Area

(16 bytes)

Register Banks (8

bytes per bank; 4

banks)

General PurposeRAM (80 bytes)

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 19/21

Memory Organization -ROM Program Memory

Only be read, not written to

The address space is 16-bit, so maximum of 64K bytes

Up to 4K bytes can be on-chip (internal) of 8051 core

PSEN (Program Store Enable) is used for access toexternal Program Memory

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 20/21

Memory Organization -ROM

8/13/2019 8051 Microcontroller Part 1

http://slidepdf.com/reader/full/8051-microcontroller-part-1 21/21

PSW – Program Status Word