Microprocessors Module 5 Important Topics
Microprocessors Module 5 Important Topics
Accumulator (A)
Saves operand for operations by ALU
B Register(B)
Saves second Operand for ALU
PSW (Process Status Word)
8 bit register to save the status information
Stack Pointer (SP)
8 bit register is incremented before data is stored onto the stack using PUSH
Instruction
Data Pointer (DPTR)
Holds external data memory address of data being fetched or to be fetched
Port P0
Port P1
Port P3
Serial Data Buffer (SBUF)
Contains 2 independent registers
Transmit Buffer
Parallel in Serial out register
Receive buffer
Serial in Parallel out register
Timer register
Two 16 bit register, can be accessed as their lower and upper bytes
TL0 -> Lower byte of timing register 0
TH0 -> Higher byte of timing register 0
TL1 ->Lower byte of timing register 1
TH1 -> Higher byte of timing register 1
Control Registers
IP - interrupt Priority Register
IE - Interrupt Enable register
TMOD - Timer Mode Register
TCON - Timer Control Register
SCON - Serial Control Register
PCON - Power Control Register
Timing and control unit
This unit derives all the necessary timing and control signals required for the internal
operation of the circuit.
Oscillator
This circuit generate the basic timing clock signals for the operation of the circuit
using crystal oscillator
Instruction Register:
This register decodes the opcode of an instruction to be executed
RAM
RAM is 128 byte memory for the read and write and is indirectly and directly
addressable.
ROM
ALU
SFR Register Bank
4 Register Banks each of 8 registers
Interrupt
Interrupt is a signal sent by external device to the processor, to request the processor to
perform a particular task or work.
When a processor recognizes an interrupt, it saves processor status in stack
Then it calls and executes interrupt Service Routine (ISR)
At the end of ISR, it restores processor status and program control is transferred to main
program
Types of interrupts are
Software and Hardware interrupt
Vectored and non vectored interrupt
Maskable and non maskable interrupt
Types of interrupt in 8051
Timer 0 overflow interrupt TF0
Timer 1 overflow Interrupt TF1
External hardware interrupt INT0
Internal hardware interrupt INT1
Serial communication interrupt RI/TI
There are 2 Special function registers (SFRs) for interrupt handling
Interrupt Enable Register
Interrupt Priority Register
TCON Register
Specifies the type of external interrupt to 8051 microcontroller
Stack
Stack is a area of RAM allocated to hold temporarily all parameters of the variable
Whenever the function is called parameters and local variables are added to stack
When Function returns, Parameters and variables are removed from stack
Register used to access the stack is called stack pointer register
When we push something into stack memory, the stack pointer increases
PUSH
Used to take values from any register and storing in starting address of stack pointer
Consider this code
POP
Used for placing values from stack pointers maximum address to other register address
It decrements the stack pointer by 1
Addressing modes
Its the way in which instruction is specified or different ways that are used by processor to
access or store data
8051 Provides 5 Addressing modes
Immediate
Direct
Register
Register Indirect
Indexed
Instruction sets
An 8051 Instruction consists of an Opcode Followed by operands
Opcode part of instruction contains the Mnemonic
This Specifies the type of operation to be performed
All mnemonics are of one byte size
Operand part of the instruction defines the data being processed by the instructions
The operand can be any of the below
Data value
I/O Port
Memory Location
CPU Register
There can be multiple operands
Based on operation performed, all instructions in 8051 instruction set are divided into 5 groups
1 .Data Transfer Instructions
Associated with transfer of data between registers or external program/data memory
2. Arithmetic Instructions
Performs basic operations like add, sub, division, multiplication etc
After execution, result is stored in first operand
3. Logical Instructions
Logical instructions perform logical operations
Boolean or Bit Manipulation Instructions
Deals with bit variables
The Boolean/Bit Manipulation instructions are
Data Manipulation Instructions
Port Instructions
Can either take data in or put data out
Uses MOV
Complement Instructions
Only A register and RAM address can be used as detination
Rotate Instructions
There are 4 rotate and 1 swap instruction
Only A Register can be used as destination
2. LJMP Target
3. AJMP Target