Sunteți pe pagina 1din 16

8051

Overview

Port 0(p0.0 to p0.7):


It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory
access, it functions as multiplexed data and low-order address bus AD0-AD7.
Port 1 (p1.0 to p1.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. When logic '1' is written into
port latch then it works as input mode. It functions as simply I/O port and it does not
have any alternative function.
Port 2 (p2.0 to p2.7):
It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory
access it functions as higher order address bus (A8-A15).
Port 3(p3.0 to port 3.7):
It is 8-bit I/O port. In an alternating function each pins can be used as a special function
I/O pin.
P3.0-RxD:
It is an Input signal. Through this I/P signal microcontroller receives serial data of serial
communication circuit.

P3.1-TxD:
It is O/P signal of serial port. Through this signal data is transmitted.
P3.2- (INT0):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral
interrupts to microcontroller.
P3.3-(INT1):
It is external hardware interrupt I/P signal. Through this user, programmer or peripheral
interrupts to microcontroller.
P3.4- T0:
It is I/P signal to internal timer-0 circuit. External clock pulses can connects to timer-0
through this I/P signal.
P3.5-T1:
It is I/P signal to internal timer-1 circuit. External clock pulses can connects to timer-1
through this I/P signal.

P3.6-[WR(bar)]:
It is active low write O/P control signal. During External RAM (Data memory) access it
is generated by microcontroller. when [WR(bar)]=0, then performs write operation.
P3.7-[RD(bar)]:
It is active low read O/P control signal. During External RAM (Data memory) access it
is generated by microcontroller. when [RD(bar)]=0, then performs read operation from
external RAM.
XTAL1 and XTAL2:
These are two I/P line for on-chip oscillator and clock generator circuit. A resonant
network as quartz crystal is connected between these two pin. 8051 microcontroller
also drives from external clock, then XTAL2 is used to drive 8051 from external clock
and XTAL1 should be grounded.
[EA(bar)]/VPP:
It is and active low I/P to 8051 microcontroller. when (EA)= 0, then 8051
microcontroller access from external program memory (ROM) only. When (EA) = 1,
then it access internal and external program memories (ROMS).

[PSEN(bar)]:
It is active low O/P signal. It is used to enable external program memory (ROM). When
[PSEN(bar)]= 0, then external program memory becomes enabled and microcontroller
read content of external memory location. Therefore it is connected to (OE) of external
ROM. It is activated twice every external ROM memory cycle.
ALE:
Address latch enable: It is active high O/P signal. When it goes high, external address
latch becomes enabling and lower address of external memory (RAM or ROM) latched
into it. Thus it separates A0-A7 address from AD0-AD7. It provides properly timed signal
to latch lower byte address. The ALE is activated twice in every machine cycle. If
external RAM & ROM is not accessed, then ALE is activated at constant rate of 1/6
oscillator frequency, which can be used as a clock pulses for driving external devices.
RESET:
It is active high I/P signal. It should be maintained high for at least two machine cycle
while oscillator is running then 8051 microcontroller resets.

8051
Today over fifty companies produce variations
of the
8051.

Several of these companies have over fifty


versions
of the 8051.

8051 cores are available for implementations


in
FPGAs or ASICs.

Over 100 million 8051s are sold each year.


The 8051 has been extremely successful, and
has
directly influenced many of the more recent
microcontroller architectures.

MCS-51
8051 belongs to MCS-51 family of
microcontrollers

MCS-51 was developed by Intel but other


manufacturers (e.g., Siemens, Philips) are
second
sources of this family.

Summary of features of the standard 8051


4K bytes internal ROM (program)
128 bytes internal RAM (data)
Four 8-bit I/O ports
Two 16-bit timers
Serial interface
64K external code memory space
64K external data memory space
210 bit-addressable locations

Memory

8051 implements a separate memory space for programs


(code) and data.

Both code and data may be internal, however, both expand


using external components to a maximum of 64K code
memory and 64K data memory.

Internal memory consists of on-chip ROM and on-chip data


RAM.

On-chip RAM contains a rich arrangement of general

purpose storage, bit addressable storage, register banks,


and special function registers.

In the 8051, the registers and input/output ports are

memory mapped and accessible like any other memory


location.

In the 8051, the stack resides within the internal RAM,


rather than in external RAM.

Register Banks

The bottom 32 locations of internal memory contain


the
register banks

8051 supports 8 registers R0 to R7 and after a system


reset
(default) the registers are at address 00H to 07H

MOV A, R5: reads the content of address 05

into the

accumulator

MOV A,05 will do the same thing


The active register bank may be altered by changing
H

the
register bank select bits in the Program Status Word
(PSW)

Idea of register banks permits fast and effective


context
switching

Special Function Registers


8051 has 21 special function registers

(SFRs) at the
top of internal RAM from address 80H to
FFH.

Most of the addresses from 80

to FFH are

not defined,
except for 21 of them.

Some SFRs are both bit-addressable and


byte
addressable, depending on the instruction
accessing
the register
Program Status
Word

Stack Pointer

Stack pointer (SP) is an 8-bit register at address 81


It contains the address of the data item currently on top
H

of the
stack.

Stack operations include pushing data on the stack and


popping data off the stack

Pushing increments SP before writing the data


Popping from the stack reads the data and decrements
the SP

8051 stack is kept in the internal RAM


Depending on the initial value of the SP, stack can have
different sizes

Example: MOV SP,#5F


On 8051 this would limit the stack to 32 bytes since the
H

uppermost address of on chip RAM is 7FH.

Interrupts
Interrupt: Interrupt Service Routine (ISR) or Interrupt Handler code is
automatically called when an interrupt occurs.
Steps in interrupt handling:
Return address saved on stack
PC is loaded with the Interrupt Vector address
ISR Code is executed
When complete, RETI instruction is used.
Flag that generated the interrupt is cleared.
PC is loaded with return address.

Interrupt Enable Register

THANK YOU

S-ar putea să vă placă și