You are on page 1of 23

8-bit microcontrollers

05/03/16

CDAC,Mohali

Agenda
MCS-51 family architecture

05/03/16

CDAC,Mohali

Computer Organization
Control unit

ALU
Memory

Output

Input

Register

Processor
05/03/16

CDAC,Mohali

Overview of MCS-51 family


Intel 8051 is a stand alone high performance single chip
computer intended for use in sophisticated real time
applications such as instrumentation, industrial control
and computer peripherals. It provides extra features like
interrupts, bit address ability and an enhanced set of
instructions, which makes the chip very powerful and cost
effective. The ease with which it can be interfaced with
the other peripheral chips make it very powerful.

05/03/16

CDAC,Mohali

The features of the 8051 core are


8-bit CPU optimized for control applications
Extensive Boolean processing (Single-bit logic) capabilities
4K ROM of on-chip Program Memory (0K (8031),
EPROM 4K (8751))
128 bytes of on-chip Data RAM
16 bit PC and DPTR
Eight bit PSW
eight bit stack pointer
05/03/16

CDAC,Mohali

Contd
32 bi-directional and individually addressable I/O lines.
Which form four 8-bit I/O Ports (P0-P3).
Two 16-bit timer/counters
Full duplex UART
6 interrupt sources with two priority levels
On-chip clock oscillator
210 bit-addressable locations.
Oscillator & Clock Circuit

05/03/16

CDAC,Mohali

Block Diagram of 8051

05/03/16

CDAC,Mohali

8051 Block Diagram

05/03/16

CDAC,Mohali

Other members of the family


8031

8051

8052

ROM

0K

4K

8K

RAM

128B

128B

256B

Timers

I/O pins

32

32

32

Serial p.

Interrupt

05/03/16

CDAC,Mohali

Other 8051 microcontrollers


UV EPROM version of 8051 is 8751
FLASH version of 8051 is 8951
OTP versions
The one by ATMEL,FLASH ROM version of 8051
is AT89C51.
AT89C51,AT89C1051,AT89C2051,AT89C52,etc

05/03/16

CDAC,Mohali

10

Pinout diagram of 8051

05/03/16

CDAC,Mohali

11

Logic Symbols

05/03/16

CDAC,Mohali

12

Pin Description of 8051


PSEN (pin 29): (Program Store Enable) Enables
external program (code) memory. Usually connected to
EPROMs output enable (OE). It pulses low during
fetch stage of an instruction. It remains high while
executing a program from internal ROM.
ALE (pin 30): (Address Latch Enable) used for demultiplexing the address and data bus when port 0 is
used as the data bus and low-byte of address bus.
EA (pin 31): (External Access) high to execute
programs from internal ROM and low to execute from
external memory only.
05/03/16

CDAC,Mohali

13

RST (pin 9): (RESET) master reset of 8051. RST pin


must be high for at least two machine cycles while the
oscillator is running. External reset is asynchronous to the
internal clock. Internal RAM is not affected by reset. Reset
sets PC to 0000H.

05/03/16

CDAC,Mohali

14

8051 Oscillator & Power Pins: Pins 18 and 19 are


the oscillator pins to connect the crystal of nominal
frequency 12 MHz.

One 8051-processor cycle consists of twelve oscillator


periods. Each of the twelve oscillator periods is used for a
special function by the 8051 core such as op code fetches .
The time required for any 8051 instructions can be
computed by dividing the clock frequency by 12, inverting
that result and multiplying it by the number of processor
cycles required by the instruction in question.

05/03/16

CDAC,Mohali

15

Therefore, if you have a system, which is using an


11.059MHz clock, you can compute the number of
instructions per second by dividing this value by 12.
This gives an instruction frequency of 921583
instructions per second. Inverting this will provide the
amount of time taken by each instruction cycle (1.085
microseconds).

05/03/16

CDAC,Mohali

16

Supply and Ground pins: Pin 40 is for +5V and pin 20


is for GND.
I/O Ports: Four 8-bit I/O ports.
Most have alternate functions.
Port 0 (pin 32-39)
Dual purpose I/O port.
In min. component design, it is used as a general
purpose I/O port.In larger designs with external memory, it
becomes a multiplexed data bus:
Low byte of address bus, strobed by ALE.
8-bit instruction bus, strobed by PSEN.
8-bit data bus, strobed by WR and RD.
05/03/16
CDAC,Mohali

17

Port 1 (pin 1-8)


As an I/O port: Standard bi-directional port for
interfacing to external devices as required for I/O.
Alternate functions: Only on some derivatives
Port 2 (pin 21-28)
Dual purpose I/O port.
As an I/O port: Standard bi-directional general
purpose I/O port.
Alternate functions: High byte of address bus for
external program and data memory accesses.

05/03/16

CDAC,Mohali

18

Port 3 (pin 10-17)is an 8-bit bi-directional I/O port with


internal pull-ups. It also serves the functions of various
special features of the 80C51.
Table of alternate uses of Port- 3 pins:
PINS

ALTERNATE USE

SFR

P3.0 RXD

Serial data input

SBUF

P3.1 TXD

Serial data output

SBUF

P3.2 INT0

External Interrupt 0

TCON.1

P3.3 INT1

External Interrupt 1

TCON.3

P3.4 T0

External Timer 0 I/P

TMOD

P3.5 T1

External Timer 1 I/P

TMOD

P3.6 WR

External Memory write pulse

P3.7 RD

External Memory read pulse

05/03/16

CDAC,Mohali

19

Pulse P: It

is the smallest interval of time within


microcontroller established by the clock frequency.
Machine Cycle: Smallest interval of time to accomplish any
simple instruction or part of complex instruction. Made up
of six states in case of MCS-51 family.
State: Basic time interval for discrete operations of machine
cycles, such as fetching op-code byte, decoding an opcode
etc.To calculate the time for any particular instruction
A and B CPU registers:Two of the general purpose
registers. Hold results of instructions particularly math and
logical operations.Register A is a versatile register, But
register B is used with A register for multiplication and
division operations and has no other function except data
may be stored in it .
05/03/16

CDAC,Mohali

20

CPU Timing
Each state is divided into 2 phases, phase-1 and phase-2.

P1

P2

State 1

State 2

State 3

State4

State 5

State 6

One Machine Cycle

ALE
05/03/16

CDAC,Mohali

21

Flags and PSW : Flags are grouped inside PSW and PCON
registers.In 8051 there are 7 flags, 4 math flags which
respond automatically to the outcomes of the math
operations and 3 general purpose flags which can be set or
reset by the programmer.
Math flags are - Auxiliary carry(AC), Carry(C), Parity(P)
and Overflow (OV)
General Purpose Flags - FO, GF0 and GF1
PSW :
CY

AC

05/03/16

F0

RS1

RS2

OV

CDAC,Mohali

22

Symbol

Function

CY

Used in arithmetic, jump, rotate & Boolean inst

AC

Used for BCD arithmetic

F0

User flag 0

RS1

RS1 and RS0 used to select one of the 4

RS0

register banks of internal RAM

OV

Used in arithmetic instructions

Shows the parity of register A

05/03/16

CDAC,Mohali

23

You might also like