0% found this document useful (0 votes)
4 views41 pages

Unit 2 Mi

The document provides an introduction to the 8051 microcontroller, detailing its specifications such as being an 8-bit device with 40 pins, 4KB ROM, and 128 bytes RAM. It explains the internal RAM organization, including Special Function Registers (SFRs) like the Accumulator, B Register, and Program Status Word, as well as the Data Pointer and Stack Pointer. Additionally, it covers peripheral control registers for power management and serial communication, along with mentions of interrupts and timers in the 8051 architecture.

Uploaded by

Sathvik
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)
4 views41 pages

Unit 2 Mi

The document provides an introduction to the 8051 microcontroller, detailing its specifications such as being an 8-bit device with 40 pins, 4KB ROM, and 128 bytes RAM. It explains the internal RAM organization, including Special Function Registers (SFRs) like the Accumulator, B Register, and Program Status Word, as well as the Data Pointer and Stack Pointer. Additionally, it covers peripheral control registers for power management and serial communication, along with mentions of interrupts and timers in the 8051 architecture.

Uploaded by

Sathvik
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/ 41

UNIT-2

Introduction to Microcontrollers
Differences between processors and
controllers
8051
• 8051 microcontroller is designed by Intel in 1981.
• It is an 8-bit microcontroller.
• It is built with 40 pins DIP (dual inline package),
• 4kb of ROM storage and
• 128 bytes of RAM storage,
• 2- 16-bit timers.
• It consists of are four parallel 8-bit ports, which are programmable as well
as addressable as per the requirement.
• An on-chip crystal oscillator is integrated in the microcontroller having
crystal frequency of 12 MHz
Pin diagram of 8051
Contd..
8051 Internal RAM organization:
SFR’s:
• The internal RAM or Data Memory of the 8051 Microcontroller is
divided in to General Purpose Registers, Bit Addressable Registers,
Register Banks and Special Function Registers or SFRs.
• The 8051 Microcontroller Special Function Registers are used to
program and control different hardware peripherals like Timers,
Serial Port, I/O Ports etc
CPU or Math Registers

• A or Accumulator (ACC)
• The Accumulator or Register A is the most important and most used
8051 Microcontroller SFRs. The Register A is located at the address
E0H in the SFR memory space. The Accumulator is used to hold the
data for almost all the ALU Operations.
• Some of the operations where the Accumulator is used are:
• Arithmetic Operations like Addition, Subtraction, Multiplication etc.
• Logical Operations like AND, OR, NOT etc.
• Data Transfer Operations (between 8051 and External Memory)
ACC
B (Register B)

• The B Register is used along with the ACC in Multiplication and


Division operations. These two operations are performed on data
that are stored only in Registers A and B. During Multiplication
Operation, one of the operand (multiplier or multiplicand) is stores in
B Register and also the higher byte of the result.
• In case of Division Operation, the B Register holds the divisor and also
the remainder of the result. It can also be used as a General Purpose
Register for normal operations and is often used as an Auxiliary
Register by Programmers to store temporary results.
B
Program Status Word (PSW)

• The PSW or Program Status Word Register is also called as Flag


Register and is one of the important SFRs. The PSW Register consists
of Flag Bits, which help the programmer in checking the condition of
the result and also make decisions.
• Flags are 1-bit storage elements that store and indicate the nature of
the result that is generated by execution of certain instructions.
P.S.W
Pointer Registers
Data Pointer (DPTR – DPL and DPH)
• The Data Pointer is a 16-bit Register and is physically the combination
of DPL (Data Pointer Low) and DPH (Data Pointer High) SFRs. The Data
Pointer can be used as a single 16-bit register (as DPTR) or two 8-bit
registers (as DPL and DPH).
• DPTR doesn’t have a physical Memory Address but the DPL (Lower
Byte of DPTR) and DPH (Higher Byte of DPTR) have separate
addresses in the SFR Memory Space. DPL = 82H and DPH = 83H.
• The DPTR Register is used by the programmer addressing external
memory (Program – ROM or Data – RAM).
Stack Pointer (SP)
• SP or Stack Pointer points out to the top of the Stack and it indicates
the next data to be accessed.
• Stack Pointer can be accesses using PUSH, POP, CALL and RET
Instructions.
• The Stack Pointer is an 8-bit register and upon reset, the Stack Pointer
is initialized with 07H.
• When writing a new data byte into the stack, the SP (Stack Pointer) is
automatically incremented by 1 and the new data is written at an
address SP+1. When reading data from stack, the data is retrieved
from the Address in SP and after that the SP is decremented by 1
(SP-1).
I/O Port Registers (P0, P1, P2 and P3)
Peripheral Control Registers
• PCON (Power Control)
• Is used to control the 8051 Microcontroller’s Power Modes and is
located at 87H of the SFR Memory Space. Using two bits in the PCON
Register, the microcontroller can be set to Idle Mode and Power
Down Mode.
• NOTE:
• During Idle Mode, the Microcontroller will stop the Clock Signal to the
ALU (CPU) but it is given to other peripherals like Timer, Serial,
Interrupts, etc.
• In order to terminate the Idle Mode, you have to use an Interrupt or
Hardware Reset. PCON register is not bit addressable.
• In the Power Down Mode, the oscillator will be stopped and the
power will be reduced to 2V. To terminate the Power Down Mode,
you have to use the Hardware Reset.
• The SMOD Bit in the PCON Register is used to control the Baud Rate
of the Serial Port.
• There are two general purpose Flag Bits in the PCON Register, which
can be used by the programmer during execution
SCON (Serial port Control)

• The SCON is used to control the 8051 Microcontroller’s Serial Port.


• It is located as an address of 98H.
• Using SCON, you can control the Operation Modes of the Serial Port,
Baud Rate of the Serial Port and Send or Receive Data using Serial
Port.
• SCON Register also consists of bits that are automatically SET when a
byte of data is transmitted or received.
SBUFF
Interrupts:
Interrupt priority :
Timers’s in 8051
TCON:
External memory connections:
CONTD..

You might also like