0% found this document useful (0 votes)
16 views21 pages

8051 Architecture For Cia1

The 8051 microcontroller, developed by Intel in 1980, is a versatile single-chip MCU series designed for embedded systems, featuring an 8-bit CPU, multiple I/O ports, timers, and a serial communication interface. It includes various registers for data processing, a program counter for instruction execution, and a stack for temporary data storage. The architecture supports both N-Channel MOSFET and CMOS technologies, making it suitable for a wide range of applications.

Uploaded by

drawinga36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views21 pages

8051 Architecture For Cia1

The 8051 microcontroller, developed by Intel in 1980, is a versatile single-chip MCU series designed for embedded systems, featuring an 8-bit CPU, multiple I/O ports, timers, and a serial communication interface. It includes various registers for data processing, a program counter for instruction execution, and a stack for temporary data storage. The architecture supports both N-Channel MOSFET and CMOS technologies, making it suitable for a wide range of applications.

Uploaded by

drawinga36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

8051 Microcontroller

The Intel MCS-51 (commonly


termed 8051) is a single
chip microcontroller (MCU) series
developed by Intel in 1980 for use
in embedded systems

The 8051 microcontroller actually includes a


whole family of microcontrollers that have
numbers ranging from 8031 to 8751 and are
available in N – Channel MOSFET and
CMOS in variety of package types.
The 8051 specific features

• 8 – bit CPU with registers A and B • 4 ports P0, P1, P2, P3 each 8 – bit length
• 16 – bit PC and DPTR • Two 16 – bit timers / counters T0, T1
• 8 – bit SP and PSW • Full Duplex serial transmitter / receiver
• 4k – internal ROM • Control registers TCON TMOD SCON
• 128 bytes of internal RAM • 2 external and 3 internal interrupt sources
4 register banks , each containing 8 registers
• Oscillator and clock circuitry ---- 1 MHz
16 bit addressable bytes to 16MHz
80 general purpose data memory

The features of the computer are best learned by the internal hardware design,
also called the architecture of the device, to determine the type number, and
size of the registers and other circuitry.
8051 Block diagram
Registers

Registers are used to store information


temporarily,

while the information could be , a byte of


data to be processed or an address pointing
to the data to be fetched,

The vast majority of 8051 registers are 8-bit


registers
Program Counter & Data Pointer
The program counter is 16 bits wide
It can access program addresses 0000 to FFFFH, a total of 64K bytes of code
The program counter points to the address of the next instruction to be executed
PC is the only register that does not have internal address
All 8051 members start at memory address 0000 when they’re powered up

Whether accessing externally connected RAM or on-chip ROM, we need 16-bit pointer in
such case, the DPTR register is used
DPTR can also be accessed as two 8-bit registers, the high byte DPH and low byte DPL
DPTR does not have single internal address
8051 Oscillator and Clock
• The heart of 8051 is the circuitry that generates the clock pulses by which all internal
operations are synchronized
• Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an
oscillator, typically Quad crystal and capacitors are employed as shown in figure
• If the basic clock frequency is not divisible without a reminder then the resulting
communication frequency is not called standard frequency

• CPU in executing an instruction takes a certain number of clock cycles


• These are referred to as machine cycles
• The length of machine cycle depends on the frequency of the crystal oscillator connected
to 8051
• In original 8051, one machine cycle lasts 12 oscillator period
The program status word (PSW)
The program status word (PSW) register, also referred to as the flag register
This is an 8 bit register
Only 6 bits are used
CY (carry)
AC (auxiliary carry)
P (parity)
and OV (overflow) – They are called conditional flags, meaning that they indicate some
conditions that resulted after an instruction was executed
The PSW3 and PSW4 are designed as RS0 and RS1, and are used to change the bank
The two unused bits are user-definable
Stack and Stack Pointer
• The stack is a section of RAM used by the CPU to store information temporarily
• This information could be data or an address
• The register used to access the stack is called the SP (stack pointer) register.
• The stack pointer in the 8051 is only 8 bit wide (SP range 00 to FFH)
• When the 8051 is powered up, the SP register contains value 07
• The storing of a CPU register in the stack is called a PUSH
• SP is pointing to the last used location of the stack
• As we push data onto the stack, the SP is incremented by one
• Loading the contents of the stack back into a CPU register is called a POP
• With every pop, the top byte of the stack is copied to the register specified by the
instruction and the stack pointer is decremented once
MOV R6, #25H
MOV R1, #12H
MOV R4, #0F3H
PUSH 6
PUSH 1
PUSH 4
The SFR (Special Function Register)
These can be accessed by their names or by their addresses
While all of the SFR registers are byte addressable, some of them are also bit addressable
The list of SFRs are given below
Input / Output Ports
The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8 pins
All the ports upon RESET are configured as input, ready to be used as i/p ports
When the first 0 is written to a port, it becomes an output
To reconfigure it as an input, a 1 must be sent to the port.

It can be used for input or output

Each pin must be connected


externally to a 10K ohm pull -up
resistor

This is due to the fact that P0 is


an open drain, unlike P1, P2, and
P3
Port 0 is also designated as AD0-AD7, allowing it to be used for
both address and data, in order to make port 0 an input, the port
must be programmed by writing 1 to all the bits

Port 1 can be used as input or output, in contrast to port 0, this


port does not need any pull-up resistors since it already has pull-
up resistors internally, upon reset, port 1 is configured as an input
port, to make port 1 an input port, it must be programmed as such
by writing 1 to all its bits

Port 2 can be used as input or output, it does not need any pullup
resistors since it already has pull-up resistors internally, upon
reset, port 2 is configured as an input port, to make port 2 an
input port, it must be programmed as such by writing 1 to all its
bits
Port 2 is also designated as A8 – A15, indicating its dual function
Port 0 provides the lower 8 bits via A0 – A7
Port 3 can be used as
input or output

Port 3 does not need any


pull-up resistors

Port 3 is configured as an
input port upon reset, this
is not the way it is most
commonly used

Port 3 has the additional


function of providing
some extremely
important signals
Timer / Counter
The 8051 has two timers/counters by name (T0 and T1), they can be used either as
Timers to generate a time delay or as
Event counters to count events happening outside the microcontroller
Both Timer 0 and Timer 1 are 16 bits wide
Each 16-bits Timer is accessed as two separate registers of low byte and high byte
The low byte register is called TL0/TL1 and
The high byte register is called TH0/TH1
Accessed like any other register
Both T0 and T1 use the same register,
called TMOD (timer mode),
to set the various timer operation modes.

TMOD and TCON (timer control)


registers are 8- bit , bit-addressable registers
TCON register is used to control the action of timers (start / stop the timer/counter)
The frequency for the timer is always
1/12th the frequency of the crystal attached to the 8051,regardless of the 8051 version.
Serial data Communication
One cost – effective way to communicate is to send and receive data bits serially.

Serial data communication uses two methods


Synchronous method transfers a block of data at a time
Asynchronous method transfers a single byte at a time

The rate of data transfer in serial data communication is stated in bps (bits per second)
Another widely used terminology for bps is baud rate

The 8051 has a serial data communication circuit that uses register SBUF to hold data.
Register SCON controls data communication,
Register PCON controls data rates,
Pins RXD (P3.0) and TXD (P3.1) connect to the serial data network.

You might also like