0% found this document useful (0 votes)
10 views8 pages

Microprocessor Instruction Set Overview

Chapter 5 discusses the instruction set of microprocessors, detailing types of instructions such as data transfer, arithmetic, logical, control, and branching instructions, as well as the differences between microprocessor and microcontroller instruction sets. It highlights the importance of instruction set architectures (CISC and RISC) and the role of assembly language and machine code in programming. Chapter 6 focuses on I/O interfacing, explaining communication methods between microprocessors and peripherals, including isolated and memory-mapped I/O, as well as the significance of handshaking in data transfer.

Uploaded by

ainzzmomon
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)
10 views8 pages

Microprocessor Instruction Set Overview

Chapter 5 discusses the instruction set of microprocessors, detailing types of instructions such as data transfer, arithmetic, logical, control, and branching instructions, as well as the differences between microprocessor and microcontroller instruction sets. It highlights the importance of instruction set architectures (CISC and RISC) and the role of assembly language and machine code in programming. Chapter 6 focuses on I/O interfacing, explaining communication methods between microprocessors and peripherals, including isolated and memory-mapped I/O, as well as the significance of handshaking in data transfer.

Uploaded by

ainzzmomon
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

Chapter 5: Instruction Set

Instruction set

- is a collection of commands that the processor can execute.


- define the operations a microprocessor can perform and are crucial in designing
software for embedded systems, computers, and microcontrollers.

Types of Instructions in a Microprocessor

- Data transfer functions


o These instructions move data between registers, memory, and I/O devices. (ex.
MOV, LOAD)
- Arithmetic Instructions
o Perform arithmetic operations such as addition, subtraction, multiplication, and
division (ex. ADD, SUB)
- Logical Instructions
o Execute bitwise operations and logical comparisons. (ex. AND, OR)
- Control Instructions
o Control the execution sequence of a program, including jump, call, and return
instructions. (ex. JMP, CALL)
- Branching Instructions
o Used for decision-making and conditional execution. (ex. JZ, JNZ)
- Stack and I/O Instructions
o Manage stack operations and input/output communication. (ex. PUSH, POP)

Instruction Set Architectures (ISA)

- The way instructions are structured in a microprocessor. Two primary types:


- CISC (Complex Instruction Set Computing)
o Large instruction, complex operations, Fewer instructions, takes more clock
cycles (ex. Intel x86)
- RISC (Reduced Instruction Set Computing)
o Simple and limited instruction set, Faster execution (ex. ARM)

Importance of Instruction Set in Microprocessor Systems

- Determines the functionality of the processor


- Affects program execution speed and efficiency
- Helps in designing assembly language programs
- Influences the choice of microprocessor for an application

An instruction set of a microcontroller

- refers to the predefined set of commands


- crucial in programming microcontrollers
- instructions that needs to be executed
- provide direction to the microcontroller and help it execute functions
- collection of instructions that the developer uses

Difference Between Instruction Set of a Microprocessor and a Microcontroller

PURPOSE:

- MPIC (Microprocessor Instruction Set) - for general-purpose computing


- MCIC (Microcontroller Instruction Set) - Designed for specific embedded applications
Complexity:

- MPIC - has a larger and more complex instruction set


- MCIC - a simplified and optimized instruction set

Instruction Type Focus

- MPIC - focus on data processing, memory management, and arithmetic operations.


- MCIC - emphasis on I/O control, bitwise operations, and real-time processing.

Data Transfer Instructions

- MPIC - Handles large data movement


- MCIC - Focuses on moving data efficiently

Arithmetic & Logical Instructions

- MPIC - Supports advanced arithmetic operations


- MCIC - designed for basic arithmetic, bitwise logic, and control operations.

Branching & Control Instructions

- MPIC - Supports advanced control flow


- MCIC - Efficient control flow

Bit Manipulation Instructions

- MPIC - Limited bitwise operations


- MCIC - Extensive bit manipulation instructions
-

Peripheral Control Instructions

- MPIC - Requires external interfacing for I/O operations


- MCIC - Includes direct I/O operations

Memory Access

- MPIC - Uses external memory for program


- MCIC - Has onboard memory

Execution Efficiency

- MPIC - More powerful but requires multiple clock cycles


- MCIC - Optimized for single-cycle execution in RISC-based architectures.

ASSEMBLY LANGUAGE

- low-level programming language with symbolic representation


- specific to a particular microprocessor architecture
- uses mnemonics

Structure of Assembly Language

- Opcode (Operation Code) - Specifies the operation to be performed


- Operands - Specifies the data or memory location involved in the operation.
- Addressing Modes - Defines how the operands are accessed

Advantages of Assembly Language

- programs interface with OS, processor, and BIOS;


- data is represented in memory and other external devices;
- the processor accesses and executes instruction;
- instructions access and process data
- a program accesses external devices.

Applications of Assembly Language

- Embedded Systems – Microcontrollers


- Operating Systems and Device Drivers - Kernel development
- Performance-Critical Applications - Real-time systems
- Reverse Engineering and Security - Malware analysis

Assembler

- is a software tool that translates assembly language into machine code

Assembly Language Structure

- The data Section – is used for declaring initialized data or constants.


- The bss Section - is used for declaring variables.
- The text section - is used for keeping the actual code

Syntax of Assembly Language Statements

The fields in the square brackets are optional

Basic instruction has two parts - the name of the instruction (mnemonic), the operands or the
parameters of the command.

Machine Code

– also known as machine language or native code, is the elemental language

of computers.
- also known as machine language or native code, is the elemental language

of computers.
- consists of binary instructions

- is specific to the architecture of the microprocessor

Structure of Machine Code (same lang din sa assembly)

- Opcode (Operation Code) - Specifies the operation to be performed


- Operands - Identify the data or memory locations involved in the operation.
- Addressing Modes – Define how the operands are accessed

Role in Microprocessor Systems

- Direct Execution - The microprocessor fetches, decodes, and executes machine code
instructions from memory.
- Efficiency - Programs in machine code execute faster than interpreted or high-level
code.
- Microcontroller Applications - Embedded systems use machine code for precise control
in automation, robotics, and communication devices.
Challenges of Machine Code Programming

- Hard to read and write.


- Machine code is not portable across different microprocessors
- Difficult debugging or finding and fixing errors in machine code is complex.

Addressing Modes

- define how an operand (data) is accessed in a microprocessor system.

Addressing modes supported by the 8086 processor

- Register Addressing - the operand is placed in one of the CPU registers


- Immediate Addressing - the operand is a constant value or immediate data that is part
of the instruction itself.
- Direct Addressing - the operand's address (memory address) is directly specified in the
instruction
- Indirect Addressing - the address of the operand is stored in a register or memory
location, and the data is at that address.
- Indirect Addressing - the effective address of the operand is determined by adding a
constant offset (displacement) to a base register.
- Indexed Addressing - effective address is calculated using an index register plus an
optional displacement.
- Base-plus-index addressing - the effective address is calculated by adding a base
register and an index register
o Base Register (BX or BP) - Holds the starting address of a structure
o Index Register (SI or DI) - Provides an additional offset
o Displacement (Immediate Value) - A fixed constant added to fine-tune the
address

ACTIVITY
• What is an instruction set in a microprocessor?
Answer: A collection of commands that a microprocessor can execute.
• What is the primary function of logical instructions in a microprocessor?
Answer: To perform operations like AND, OR, and XOR.
• Which type of instruction is used to move data from one register to another?
Answer: Data transfer.
• What does the JMP instruction do in an instruction set?
Answer: Moves to a memory location to continue execution.
• Which of the following is NOT a type of microprocessor instruction?
Answer: Peripheral.
• Which instruction is commonly used to call a subroutine in a microprocessor?
Answer: CALL.
• What is the purpose of the RET instruction in a microprocessor?
Answer: It returns from a subroutine to the main program.
• Which of the following addressing modes is typically used when an instruction directly
specifies the operand value?
Answer: Immediate.
• What happens when an instruction like PUSH is executed in a stack-based microprocessor?
Answer: The stack pointer moves to the next lower address.
• Which of the following instructions is used to perform bitwise rotation in a microprocessor?
Answer: ROL.
• What is the primary difference between JMP and CALL instructions in a microprocessor?
Answer: CALL saves the return address, while JMP does not.
• Which of the following conditions will be affected by the execution of a CMP instruction?
Answer: The processor flags such as Zero and Carry Flag.
• What is the primary purpose of an instruction that performs AND operations at the bitwise
level?
Answer: To test specific bits in a register or memory.
• When an instruction uses indirect addressing mode, where is the actual operand stored?
Answer: In the memory location pointed to by a register.
• What is the function of the HLT instruction in a microprocessor?
Answer: It stops execution until a hardware interrupt occurs.
• What happens when an assembly language program is assembled?
Answer: The program is converted into machine code that the processor can execute.
• How does an assembler handle labels in an assembly language program?
Answer: It translates labels into memory addresses during the assembly process.
• In machine code, why are instructions typically stored as hexadecimal values instead of binary?
Answer: Hexadecimal is easier for humans to read and write.
• What is the purpose of an assembler directive in assembly language?
Answer: To provide instructions for how the assembler should process the code.
• Which of the following is a valid reason to use assembly language instead of a high-level
language?
Answer: To improve execution speed and hardware efficiency.

Immediate Addressing Mode - Stores a value directly in the instruction itself.

PUSH Instruction - Stores a value in the stack.

POP Instruction - Retrieves the last value pushed onto the stack.

CALL Instruction - Transfers control to a subroutine and saves the return address.

HLT Instruction - Stops execution until an external interrupt occurs.

CMP Instruction - Updates flags but does not change operand values.

XOR AX, AX - Clears the register by setting it to zero.

JMP Instruction- Directly changes the instruction pointer to a new location.

Indirect Addressing Mode - Uses a memory address stored in a register to access data.

AND Instruction - Performs a bitwise operation to clear specific bits.


CHAPTER 6: I/O INTERFACING
I/O Interfacing

- method by which a microprocessor communicates


- allows data exchange between the CPU and peripherals like sensors

Interface Design Considerations

- Speed of communication
- Voltage compatibility
- Handshaking
- Buffering and timing

Isolated and Memory-Mapped I/O

- Isolated I/O - also known as Port-Mapped I/O (PMIO), is a method used in


microprocessor systems to manage communication between the CPU and external I/O
devices like keyboards, displays, or sensors.
- Memory-Mapped I/O - or MMIO, is another method for connecting input/output (I/O)
devices to a microprocessor system, where I/O devices share the same address space as
memory.

Basic Input and Output Interfaces

- The basic input device is a set of three-state buffers. The basic output device is a set of
data latches

The Basic Input Interface

- Three-state buffers are used to construct the 8-bit input port

The Basic Output Interface

- The basic output interface receives data from the microprocessor and usually must hold
it for some external device
- Latches are needed to hold the data

Input Devices

- Input devices are already TTL and compatible, and therefore can be connected

Output Devices

- Output devices are far more diverse than input devices, but many are interfaced in a
uniform manner.

I/O Port Addressing Decoding

Addressing Decoding - is the process of determining which device (memory or I/O) should
respond to a specific address placed on the address bus by the CPU

- is the process where many devices (RAM, ROM, I/O ports) are connected to the same
address, data, and control buses.
- The process that makes the memory function at a unique section or partition of the
memory map.

Decoding 8-Bit I/O Port Addresses

- In Isolated I/O, an I/O device is assigned a port number, which is an address separate
from the memory space. If using 8-bit I/O addressing, this means:
o The CPU can access 2⁸ = 256 unique I/O port addresses.
o Each I/O port is identified by an 8-bit number: 00H to FFH.
- These are decoded by a decoder circuit to determine which I/O device should respond
to a given address.

ANALOG-TO-DIGITAL (ADC) AND DIGITAL-TO-ANALOG (DAC) CONVERTERS

The DAC0830 Digital-to-Analog Converter

- A fairly common and low-cost digital-to-analog converter


- This device is an 8-bit converter that transforms an 8-bit binary number into an analog
voltage.

The ADC080X Analog-to-Digital Converter

- A common, low-cost ADC


- belongs to a family of converters that are all identical, except for accuracy

Handshaking

- used to manage communication between devices, ensuring that data is transferred


accurately and reliably
- used to control the flow of data
- an I/O control approach to synchronize I/O devices
- helps in:
o Avoiding data loss or corruption.
o Synchronizing data transfer.
o Managing timing differences between devices

Common Handshaking Signals

- READY - Indicates that the peripheral is ready to communicate.


- WAIT - Tells the microprocessor to pause until the peripheral is ready.
- STROBE - Signals that valid data is on the bus
- ACK - Acknowledges that data has been received.

Application Areas

- Serial communication
- Parallel ports
- DMA
- Interfacing ADCs/DACs or memory devices.
Chapter 6: I/O Interfacing - Questions and
Answers
- What is I/O interfacing in a microprocessor system?
Answer: I/O interfacing is the method by which a microprocessor communicates and
exchanges data with peripherals such as sensors, keyboards, or displays.
- What is one key consideration in interface design for I/O communication?
Answer: Speed of communication.
- What is Isolated I/O also known as?
Answer: Port-Mapped I/O (PMIO).
- How does Isolated I/O manage communication in a microprocessor system?
Answer: It manages communication between the CPU and external I/O devices by
assigning each device a unique port address separate from the memory space.
- What is a characteristic of Memory-Mapped I/O?
Answer: I/O devices share the same address space as memory.
- What is the role of three-state buffers in a basic input interface?
Answer: Three-state buffers are used to construct an 8-bit input port, allowing data to be
read from input devices.
- What is the function of latches in a basic output interface?
Answer: Latches hold data received from the microprocessor for an external device.
- Why are input devices typically easy to interface with a microprocessor?
Answer: Input devices are already TTL-compatible and can be connected directly.
- How are output devices generally interfaced with a microprocessor?
Answer: Output devices are interfaced in a uniform manner despite their diversity.
- What is addressing decoding in a microprocessor system?
Answer: Addressing decoding is the process of determining which device (memory or
I/O) should respond to a specific address placed on the address bus by the CPU.
- What does addressing decoding enable in a system with multiple devices?
Answer: It allows many devices (RAM, ROM, I/O ports) to be connected to the same
address, data, and control buses.
- How many unique I/O port addresses can a CPU access with 8-bit I/O addressing?
Answer: 256 unique I/O port addresses.
- What range of addresses is used for 8-bit I/O ports?
Answer: 00H to FFH.
- What is the role of a decoder circuit in 8-bit I/O port addressing?
Answer: The decoder circuit determines which I/O device should respond to a given port
address.
- What is the DAC0830?
Answer: The DAC0830 is a common, low-cost 8-bit digital-to-analog converter that
transforms an 8-bit binary number into an analog voltage.
- What is a key feature of the ADC080X analog-to-digital converter?
Answer: It is a common, low-cost ADC that belongs to a family of converters identical
except for accuracy.
- What is the purpose of handshaking in I/O interfacing?
Answer: Handshaking manages communication between devices to ensure accurate and
reliable data transfer.
- What is one benefit of handshaking in data transfer?
Answer: It avoids data loss or corruption.
- Which handshaking signal indicates that a peripheral is ready to communicate?
Answer: READY.
- In which application area is handshaking commonly used?
Answer: Serial communication.
-

You might also like