Module V- Microprocessor
and Microcontroller
Microprocessor- 8086- Introduction, Architecture, Instruction- set,
Addressing modes, Assembly language programming
Microcontroller- 8051- Introduction, Architecture, Instruction- set,
Peripherals (stepper motors, DAC and ADC)
Microprocessors
• A microprocessor is an integrated circuit (IC) that functions
as the central processing unit (CPU) of a computer.
• It performs arithmetic and logic operations, controls data flow,
and manages other hardware components of a system.
• Microprocessors are the "brains" of computers, enabling them
to process instructions and execute tasks.
• A microprocessor is an electronic device that can fetch,
decode, and execute instructions from memory to perform
computing tasks.
• It operates using binary data (0s and 1s) and works in
close coordination with memory and input/output devices.
Basic Architecture
A microprocessor system typically consists of:
• ALU (Arithmetic Logic Unit): Performs arithmetic (addition,
subtraction, etc.) and logical (AND, OR, NOT) operations.
• Registers: Small, high-speed storage elements that temporarily
hold data and instructions.
• Control Unit (CU): Directs the operations of the processor —
controls data flow between ALU, memory, and I/O devices.
• Bus System: Communication paths that connect the processor
with memory and peripherals.
• Address Bus – carries memory addresses.
• Data Bus – carries actual data.
• Control Bus – carries control signals.
What is a bus?
• A bus is a group of parallel wires (or lines) that is
used to transfer data, addresses, and control
signals between different components of a computer
system — such as the CPU, memory, and
input/output (I/O) devices.
• A bus is a communication pathway that connects
various parts of the computer so they can share
information.
Types of Buses
• Address Bus
• Data Bus
• Control Bus
Address Bus
•Purpose: Carries the address of memory or I/O location where data is to be read or written.
•Direction: Unidirectional — only from the CPU → Memory/I/O.
•Width: Depends on the microprocessor.
•Example:
•8085 has 16-bit address bus (A0–A15) → can address 64 KB memory.
•8086 has 20-bit address bus (A0–A19) → can address 1 MB memory.
Data Bus
•Purpose: Carries actual data or instructions between the CPU, memory, and I/O devices.
•Direction: Bidirectional —
•CPU → Memory/I/O (Write operation)
•Memory/I/O → CPU (Read operation)
•Width: Depends on processor type.
•Example:
•8085 → 8-bit data bus (D0–D7)
•8086 → 16-bit data bus (D0–D15)
Control Bus
•Purpose: Carries control and timing signals used to coordinate and manage all processor activities.
•Direction: Bidirectional — both CPU and other devices can send control signals.
•Examples of Control Signals:
Key Features of a Microprocessor
• Integrated Design: Combines the CPU's functionality onto a single chip, making it
compact and efficient.
• Programmable: It operates based on a set of instructions called a program.
• Arithmetic and Logic Unit (ALU): Performs mathematical and logical operations.
• Control Unit (CU): Directs the flow of data between the microprocessor and other
components.
• Registers: Small storage locations inside the processor for temporary data storage.
• Clock Speed: Determines the number of instructions the microprocessor can execute
per second, measured in hertz (Hz).
Applications of Microprocessors
• Personal computers and laptops
• Embedded systems (e.g., washing machines, microwaves)
• Smartphones and tablets
• Robotics and automation
• Medical devices and instrumentation
• Examples:
• Intel 8085: A classic 8-bit microprocessor.
• Intel Core i-series: Modern multi-core microprocessors
for personal computers.
• ARM Cortex: ARM stands for Advanced RISC Machine.
Widely used in mobile and embedded systems
Microprocessor - 8086
• 8086 Microprocessor is an enhanced version of 8085
Microprocessor that was designed by Intel in 1976.
• It is a 16-bit Microprocessor having 20 address lines
and16 data lines that provides up to 1MB storage.
• It consists of powerful instruction set, which provides
operations like multiplication and division easily.
• It supports two modes of operation, i.e. Maximum mode
and Minimum mode.
• Maximum mode is suitable for system having multiple
processors and Minimum mode is suitable for system
having a single processor.
Features of 8086
• It has an instruction queue, which is capable of storing six
instruction bytes from the memory resulting in faster
processing.
• It was the first 16-bit processor having 16-bit ALU, 16-bit
registers, internal data bus, and 16-bit external data bus
resulting in faster processing.
• It uses two stages of pipelining, i.e. Fetch Stage and Execute
Stage, which improves performance.
• Fetch stage can prefetch up to 6 bytes of instructions and
stores them in the queue.
• Execute stage executes these instructions.
• It has 256 vectored interrupts.
• It consists of 29,000 transistors.
Architecture of 8086
• The architecture of the 8086 microprocessor is based on
a complex instruction set computer (CISC) architecture,
which means that it supports a wide range of
instructions, many of which can perform multiple
operations in a single instruction.
• The 8086 microprocessor has a 20-bit address bus,
which can address up to 1 MB of memory, and a 16-bit
data bus, which can transfer data between the
microprocessor and memory or I/O devices.
• The 8086 microprocessor has a segmented memory
architecture, which means that memory is divided into
segments that are addressed using both a segment
register and an offset.
• The segment register points to the start of a segment,
while the offset specifies the location of a specific byte
within the segment. This allows the 8086
microprocessor to access large amounts of memory,
while still using a 16-bit data bus.
• The 8086 microprocessor has two main execution units:
the execution unit (EU) and the bus interface unit (BIU).
• The BIU is responsible for fetching instructions from
memory and decoding them, while the EU executes the
instructions.
• The BIU also manages data transfer between the
microprocessor and memory or I/O devices.
• The 8086 microprocessor has a rich set of registers,
including general-purpose registers, segment registers,
and special registers.
• The general-purpose registers can be used to store data
and perform arithmetic and logical operations, while the
segment registers are used to address memory
segments.
• The special registers include the flags register, which
stores status information about the result of the
previous operation, and the instruction pointer (IP),
which points to the next instruction to be executed.
• The internal architecture of Intel 8086 is divided into 2
units: The Bus Interface Unit (BIU), and The
Execution Unit (EU).
Execution Unit
• Execution unit gives instructions to BIU stating from
where to fetch the data and then decode and execute
those instructions.
• Its function is to control operations on data using the
instruction decoder & ALU.
• EU has no direct connection with system buses, it
performs operations over data through BIU.
Functional Parts
ALU
It handles all arithmetic and logical operations, like +, −,
×, /, OR, AND, NOT operations.
Flag Register
It is a 16-bit register that behaves like a flip-flop, i.e. it
changes its status according to the result stored in the
accumulator. It has 9 flags and they are divided into 2
groups − Conditional Flags and Control Flags.
• Conditional Flags
It represents the result of the last arithmetic or logical
instruction executed.
Following is the list of conditional flags:
• Carry flag − This flag indicates an overflow condition
for arithmetic operations.
• Auxiliary flag − When an operation is performed at
ALU, it results in a carry/borrow from lower nibble (i.e.
D0 – D3) to upper nibble (i.e. D4 – D7), then this flag is
set, i.e. carry given by D3 bit to D4 is AF flag. The
processor uses this flag to perform binary to BCD
conversion.
• Parity flag − This flag is used to indicate the parity of the
result, i.e. when the lower order 8-bits of the result
contains even number of 1’s, then the Parity Flag is set.
For odd number of 1’s, the Parity Flag is reset.
• Zero flag − This flag is set to 1 when the result of
arithmetic or logical operation is zero else it is set to 0.
• Sign flag − This flag holds the sign of the result, i.e. when
the result of the operation is negative, then the sign flag is
set to 1 else set to 0.
• Overflow flag − This flag represents the result when the
system capacity is exceeded.
Control Flags
• Control flags controls the operations of the execution unit. Following
is the list of control flags:
• Trap flag − It is used for single step control and allows the user to
execute one instruction at a time for debugging. If it is set, then the
program can be run in a single step mode.
• Interrupt flag − It is an interrupt enable/disable flag, i.e. used to
allow/prohibit the interruption of a program. It is set to 1 for interrupt
enabled condition and set to 0 for interrupt disabled condition.
• Direction flag − It is used in string operation. As the name suggests
when it is set then string bytes are accessed from the higher
memory address to the lower memory address and vice-a-versa.
• General purpose register
There are 8 general purpose registers, i.e., AH, AL, BH,
BL, CH, CL, DH, and DL.
These registers can be used individually to store 8-bit
data and can be used in pairs to store 16bit data.
The valid register pairs are AH and AL, BH and BL, CH
and CL, and DH and DL.
It is referred to the AX, BX, CX, and DX respectively.
• AX register − It is also known as accumulator register.
It is used to store operands for arithmetic operations.
• BX register − It is used as a base register. It is used to
store the starting base address of the memory area
within the data segment.
• CX register − It is referred to as counter. It is used in
loop instruction to store the loop counter.
• DX register − This register is used to hold I/O port
address for I/O instruction.
Stack pointer register
• It is a 16-bit register, which holds the address from the
start of the segment to the memory location, where a
word was most recently stored on the stack.
BIU (Bus Interface Unit)
• BIU takes care of all data and addresses transfers on the
buses for the EU like sending addresses, fetching
instructions from the memory, reading data from the
ports and the memory as well as writing data to the
ports and the memory.
• EU has no direct connection with System Buses so this
is possible with the BIU. EU and BIU are connected with
the Internal Bus.
• Functional Parts
Instruction queue − BIU contains the instruction
queue. BIU gets upto 6 bytes of next instructions and
stores them in the instruction queue. When EU executes
instructions and is ready for its next instruction, then it
simply reads the instruction from this instruction queue
resulting in increased execution speed.
Fetching the next instruction while the current instruction
executes is called pipelining.
• Segment register − BIU has 4 segment buses, i.e. CS,
DS, SS& ES. It holds the addresses of instructions and
data in memory, which are used by the processor to
access memory locations. It also contains 1 pointer
register IP, which holds the address of the next
instruction to executed by the EU.
• CS − It stands for Code Segment. It is used for addressing a
memory location in the code segment of the memory, where
the executable program is stored.
• DS − It stands for Data Segment. It consists of data used by
the program and is accessed in the data segment by an offset
address or the content of other register that holds the offset
address.
• SS − It stands for Stack Segment. It handles memory to store
data and addresses during execution.
• ES − It stands for Extra Segment. ES is additional data
segment, which is used by the string to hold the extra
destination data.
• Instruction pointer − It is a 16-bit register used to
hold the address of the next instruction to be executed.
8086 Instruction Set
• The instruction set of the 8086 microprocessor
refers to the set of operations the processor can
perform.
• These instructions are divided into several categories
based on their functionality.
Data Transfer Instructions
• These instructions are used to transfer the data from the source
operand to the destination operand.
• MOV − Used to copy the byte or word from the
provided source to the provided destination.
• PUSH − Used to put a word at the top of the stack.
• POP − Used to get a word from the top of the stack to
the provided location.
• PUSHA − Used to put all the registers into the stack.
• POPA − Used to get words from the stack to all
registers.
• XCHG − Used to exchange the data from two locations.
Instructions for input and output port transfer
• IN − Used to read a byte or word from the provided port
to the accumulator.
• OUT − Used to send out a byte or word from the
accumulator to the provided port.
Instructions to transfer the address
• LEA − Used to load the address of operand into the
provided register.
• LDS − Used to load DS register and other provided
register from the memory
• LES − Used to load ES register and other provided
register from the memory.
Instructions to transfer flag registers
• LAHF − Used to load AH with the low byte of the flag
register.
• SAHF − Used to store AH register to low byte of the flag
register.
• PUSHF − Used to copy the flag register at the top of
the stack.
• POPF − Used to copy a word at the top of the stack to
the flag register.
Arithmetic Instructions
• These instructions are used to perform arithmetic
operations like addition, subtraction, multiplication,
division, etc.
• Following is the list of instructions under this group
• Instructions to perform addition
• ADD − Used to add the provided byte to byte/word to
word.
• ADC − Used to add with carry.
• INC − Used to increment the provided byte/word by 1.
• AAA − Used to adjust ASCII after addition.
• DAA − Used to adjust the decimal after the
addition/subtraction operation.
• Instructions to perform subtraction
• SUB − Used to subtract the byte from byte/word from
word.
• SBB − Used to perform subtraction with borrow.
• DEC − Used to decrement the provided byte/word by 1.
• NPG − Used to negate each bit of the provided byte/word
and add 1/2’s complement.
• CMP − Used to compare 2 provided byte/word.
• AAS − Used to adjust ASCII codes after subtraction.
• DAS − Used to adjust decimal after subtraction.
• Instruction to perform multiplication
• MUL − Used to multiply unsigned byte by byte/word by
word.
• IMUL − Used to multiply signed byte by byte/word by
word.
• AAM − Used to adjust ASCII codes after multiplication.
• Instructions to perform division
• DIV − Used to divide the unsigned word by byte or
unsigned double word by word.
• IDIV − Used to divide the signed word by byte or signed
double word by word.
• AAD − Used to adjust ASCII codes after division.
• CBW − Used to fill the upper byte of the word with the
copies of sign bit of the lower byte.
• CWD − Used to fill the upper word of the double word
with the sign bit of the lower word.
Bit Manipulation Instructions
• These instructions are used to perform operations
where data bits are involved, i.e. operations like logical,
shift, etc.
• Following is the list of instructions under this group
• Instructions to perform logical operation
• NOT − Used to invert each bit of a byte or word.
• AND − Used for adding each bit in a byte/word with the
corresponding bit in another byte/word.
• OR − Used to multiply each bit in a byte/word with the
corresponding bit in another byte/word.
• XOR − Used to perform Exclusive-OR operation over each
bit in a byte/word with the corresponding bit in another
byte/word.
• TEST − Used to add operands to update flags, without
affecting operands.
• Instructions to perform shift operations
• SHL/SAL − Used to shift bits of a byte/word towards left
and put zero(S) in LSBs.
• SHR − Used to shift bits of a byte/word towards the
right and put zero(S) in MSBs.
• SAR − Used to shift bits of a byte/word towards the
right and copy the old MSB into the new MSB.
• Instructions to perform rotate operations
• ROL − Used to rotate bits of byte/word towards the left,
i.e. MSB to LSB and to Carry Flag [CF].
• ROR − Used to rotate bits of byte/word towards the
right, i.e. LSB to MSB and to Carry Flag [CF].
• RCR − Used to rotate bits of byte/word towards the
right, i.e. LSB to CF and CF to MSB.
• RCL − Used to rotate bits of byte/word towards the left,
i.e. MSB to CF and CF to LSB.
String Instructions
• String is a group of bytes/words and their memory is
always allocated in a sequential order.
• Following is the list of instructions under this group −
• REP − Used to repeat the given instruction till CX ≠ 0.
• REPE/REPZ − Used to repeat the given instruction until CX = 0 or zero flag
ZF = 1.
• REPNE/REPNZ − Used to repeat the given instruction until CX = 0 or zero
flag ZF = 1.
• MOVS/MOVSB/MOVSW − Used to move the byte/word from one string to
another.
• COMS/COMPSB/COMPSW − Used to compare two string bytes/words.
• INS/INSB/INSW − Used as an input string/byte/word from the I/O port to the
provided memory location.
• OUTS/OUTSB/OUTSW − Used as an output string/byte/word from the
provided memory location to the I/O port.
• SCAS/SCASB/SCASW − Used to scan a string and compare its byte with a
byte in AL or string word with a word in AX.
• LODS/LODSB/LODSW − Used to store the string byte into AL or string word
into AX.
Program Execution Transfer Instructions (Branch and
Loop Instructions)
• These instructions are used to transfer/branch the
instructions during an execution. It includes the
following instructions −
• Instructions to transfer the instruction during an
execution without any condition −
• CALL − Used to call a procedure and save their return
address to the stack.
• RET − Used to return from the procedure to the main
program.
• JMP − Used to jump to the provided address to proceed
to the next instruction.
• Instructions to transfer the instruction during an execution with some
conditions −
• JA/JNBE − Used to jump if above/not below/equal instruction satisfies.
• JAE/JNB − Used to jump if above/not below instruction satisfies.
• JBE/JNA − Used to jump if below/equal/ not above instruction
satisfies.
• JC − Used to jump if carry flag CF = 1
• JE/JZ − Used to jump if equal/zero flag ZF = 1
• JG/JNLE − Used to jump if greater/not less than/equal instruction
satisfies.
• JGE/JNL − Used to jump if greater than/equal/not less than instruction
satisfies.
Processor Control Instructions
• These instructions are used to control the processor action by
setting/resetting the flag values.
• Following are the instructions under this group −
• STC − Used to set carry flag CF to 1
• CLC − Used to clear/reset carry flag CF to 0
• CMC − Used to put complement at the state of carry flag CF.
• STD − Used to set the direction flag DF to 1
• CLD − Used to clear/reset the direction flag DF to 0
• STI − Used to set the interrupt enable flag to 1, i.e., enable INTR input.
• CLI − Used to clear the interrupt enable flag to 0, i.e., disable INTR
input.
Iteration Control Instructions
• These instructions are used to execute the given
instructions for number of times. Following is the list of
instructions under this group −
• LOOP − Used to loop a group of instructions until the
condition satisfies, i.e., CX = 0
• LOOPE/LOOPZ − Used to loop a group of instructions
till it satisfies ZF = 1 & CX = 0
• LOOPNE/LOOPNZ − Used to loop a group of
instructions till it satisfies ZF = 0 & CX = 0
• JCXZ − Used to jump to the provided address if CX = 0
Interrupt Instructions
• These instructions are used to call the interrupt during
program execution.
• INT − Used to interrupt the program during execution
and calling service specified.
• INTO − Used to interrupt the program during execution
if OF = 1
• IRET − Used to return from interrupt service to the
main program
• Refer your Class Notes for 8086 example program
Addressing Modes
• The addressing modes of computer architecture are the
various ways in which operand(s) of an instruction are
specified.
• These modes define how the processor finds the data it
needs to execute a command.
• The Intel 8086 microprocessor has support for many
addressing modes, each granting flexibility in addressing
memory and registers at the same time.
or
The different ways in which a source operand is denoted in an
instruction is known as addressing modes
• Immediate Addressing
• In case of immediate addressing, the operand is a
constant value or immediate data that is part of the
instruction itself.
• Example: MOV AX, 1234h - copies value 1234h into AX.
• Register Addressing
• In register addressing, the operand is placed in one of
the CPU registers.
• Example: MOV AX, BX - moves the contents of register
BX into register AX.
• Direct Addressing
• In direct addressing, the operand's address is directly
specified in the instruction itself.
• Example: MOV AX, [1234h] - displaces register AX with
the data stored at the memory location 1234h.
• Indirect Addressing
• In indirect addressing, the address of the operand is
stored in a register or memory location, and the data is
at that address.
• Example: MOV AX, [BX] - copies the data pointed to by a
16-bit signed offset relative to a 16-bit register with
data type of pointer into a 16-bit register with data type
of integer.
• Indexed Addressing
• In indexed addressing, the operand's address is
obtained by computing the offset together with a base
address stored in a register.
• Example: MOV AX, [BX+SI] - Moves the data located at
the address formed by adding the contents of BX and SI
registers into register AX.
• Based Addressing
• Like indexed addressing, but the base address is added
to the offset in the instruction.
• Example: MOV AX, [1234h+SI] – loads register AX with
data from the address that is 1234h added with SI.
• Based Indexed Addressing
• Combines based and listed addressing modes, in which
an offset is introduced to a base deal with stored in a
sign in, and an index sign in is used to in addition
regulate the address.
• Example: MOV AX, [BX DI 10h] - movements the facts
positioned on the cope with shaped through adding the
contents of BX, DI, and an instantaneous offset of 10h
into sign up AX.
Refer your class notes for the [Link] 8086 program
8051
Microcontrollers
• The 8051 microcontroller is a
popular 8-bit microcontroller
designed by Intel in 1980.
• It is widely used in embedded
systems for a variety of
applications due to its simplicity,
versatility, and ease of use.
• Although it was originally
developed by Intel, many other
companies have since produced
their own versions of the 8051,
often with extended features.
• An 8051 microcontroller is an 8-bit Harvard architecture
microcontroller and it consists of a CPU, RAM, ROM, I/O
ports, timers, and serial communication ports all
combined on one chip.
• It can control simple to highly complex operations in
embedded systems since it can carry out instructions
which are retrieved from its internal memory.
• The hardware architecture of the 8051 microcontroller
consists of several key components that work together to
perform tasks such as data processing, input/output
management, and communication.
Applications of microcontroller
• Home Appliances(TV, Washing Machine, Microwave
Ovens etc)
• Automative Applications( Automative Car Systems,
Airbag systems etc)
• Healthcare and medical devices(Heart rate Monitors,
Blood Pressure Monitors etc)
• Home Automation and Security(Security Systems, Smart
Lighting, Smart Locks).
Block Diagram
External interrupts Timer/
On-chip
Counter
Interrupt ROM for
program On-chip Timer 1 Counter
Control RAM Inputs
code Timer 0
CPU
Bus Serial
4 I/O Ports Port
OSC Control
P0 P1 P2 P3 TxD RxD
Address/Data
• CPU:
It scrutinizes and manages all processes that are carried out in the
Microcontroller.
The user has no power over the functioning of the CPU.
CPU manages different types of registers in the 8051 microcontrollers.
• Interrupts:
Interrupt is a subroutine call that reads the Microcontroller’s key function or
job and helps it to perform some other program which is extra important then.
Interrupts provide us a method to postpone or delay the current process, carry
out a sub-routine task and then all over again restart standard program
implementation.
The Micro-controller 8051 can be assembled in such a manner that it
momentarily stops or break the core program at the happening of the
interrupt.
When the sub-routine task is finished then the implementation of the core
program initiates automatically as usual.
• Memory:
The micro-controller needs a program that is a set of commands.
This program enlightens the Microcontroller to perform precise tasks.
These programs need a storage space on which they can be
accumulated and interpret by the Microcontroller to act upon any
specific process.
• Bus
• Fundamentally Bus is a group of wires which function as a communication
canal or means for the transfer of Data. These buses comprise 8, 16, or more
cables. As a result, a bus can bear 8 bits, 16 bits altogether.
• There are two types of buses:
[Link] Bus: Microcontroller 8051 consists of a 16-bit address bus. It is
brought into play to address memory positions. It is also utilized to transmit
the address from the Central Processing Unit to Memory.
[Link] Bus: Microcontroller 8051 comprise of 8 bits data bus. It is employed to
cart data.
• Oscillator
• The oscillator block plays a crucial role in generating
the clock signal that drives the entire operation of the
microcontroller.
• The oscillator provides the timing reference for the
microcontroller's internal operations, including
instruction execution, data transfer, and interaction with
peripherals.
• Types of Interrupts
• The interrupts of the 8051 microcontrollers have the following sources
• TF0 (Timer 0 Overflow Interrupt)
• TF1 (Timer 1 Overflow Interrupt)
• INT0 (External Hardware Interrupt)
• INT1 (External Hardware Interrupt)
• RI/TI (Serial Communication Interrupt)
• Memory
• The memories of the 8051 microcontroller architecture include a program
memory and data memory.
• The instructions of the CPU are stored in the Program Memory. It is
usually implemented as Read-Only Memory or ROM, where the Program
written into it will be retained even when the power is down or the system
is reset.
• Data Memory in a Microcontroller is responsible for storing values of
variables, temporary data, intermediate results, and other data for the
proper operation of the program.
• Timer and Control Unit
• The main function of a timer is to make a delay otherwise time
gap among two events. This microcontroller includes two timers
where each timer is 16-bit where the system can generate two
delays concurrently to produce the suitable delay.
• Registers
• Registers in microcontrollers are mainly used to store data and
short-term instructions which are mainly used to process
addresses to fetch data. This microcontroller includes 8-bit
registers which have 8-bit start from D0 to D7. Here, D0 to D7 is
LSB (least significant bit) and D7 is the most significant bit
(MSB).
• PSW Register
• The term PSW stands for Program status word and it is one
kind of register in the microcontroller. It is also called a flag
register, used to demonstrate the position of arithmetic logic
instructions such as zero carry bit, carry bit, etc.
Addressing Modes in 8051
• There are 6 types of addressing modes:
• Immediate AddressingMode
• Register AddressingMode
• Direct AddressingMode
• Register IndirectAddressing Mode
• Indexed AddressingMode
• Implied AddressingMode
Immediate addressing mode
• In this Immediate Addressing Mode, the data is provided
in the instruction itself. The data is provided
immediately after the opcode.
Eg: MOVA, #0AFH
Register addressing mode
• In the register addressing mode the source or
destination data should be present in a register (R0 to
R7).
• Eg: MOVA,R5
Direct Addressing Mode
• In the Direct Addressing Mode, the source or destination
address is specified by using 8-bit data in the
instruction.
• Eg: MOVR2, 45H
Register indirect addressing Mode
• In this mode, the source or destination address is given
in the register. By using register indirect addressing
mode, the internal or external addresses can be
accessed.
• Eg: MOV0E5H, @R0
Indexed addressing mode
• In the indexed addressing mode, the source memory can only be accessed from program memory
only. The destination operand is always the register A. These are some examples of Indexed
addressing mode.
Eg: MOVCA, @A+PC;
MOVCA, @A+DPTR;
The C in MOVC instruction refers to code byte. For the first instruction, let us consider A holds 30H.
And the PC value is1125H. The contents of program memory location 1155H (30H + 1125H) are
moved to register A.
Implied Addressing Mode
• In the implied addressing mode, there will be a single
operand. These types of instruction can work on specific
registers only. These types of instructions are also
known as register specific instruction.
• Eg: RLA;
SWAPA;
These are 1- byte instruction. The first one is used to
rotate the A register content to the Left. The second one
is used to swap the nibbles in A.
Instruction Sets
• Depending on operation they perform, all instructions
are divided in several groups:
• Arithmetic Instructions
Branch Instructions
Data Transfer Instructions
Logic Instructions
Bit-oriented Instructions
• Arithmetic instructions
Arithmetic instructions perform several basic operations
such as addition, subtraction, division, multiplication etc.
After execution, the result is stored in the first operand.
ADD A,R1 - The result of addition (A+R1) will be stored in
the accumulator.
• Branch Instructions
There are two kinds of branch instructions:
Unconditional jump instructions: upon their execution a
jump to a new location from where the program
continues execution is executed.
Conditional jump instructions: a jump to a new program
location is executed only if a specified condition is met.
Otherwise, the program normally proceeds with the next
instruction.
Eg: JNC rel
Jump if carry flag is not set. Short jump.
• Data Transfer Instructions
Data transfer instructions move the content of one
register to another. The register the content of which is
moved remains unchanged. If they have the suffix “X”
(MOVX), the data is exchanged with external memory.
• MOV A,Rn
Moves the register to the accumulator
• Logic Instructions
Logic instructions perform logic operations upon
corresponding bits of two registers. After execution, the
result is stored in the first operand.
• ANL A,Rn
AND register to accumulator
• Bit-oriented Instructions
Similar to logic instructions, bit-oriented instructions
perform logic operations. The difference is that these
are performed upon single bits.
• CLR C
Clears the carry flag