Specifies the data or memory location for the operation
Classification of Instruction Set
8085 Microprocessor Instruction Set
8085 Microprocessor
8-bit microprocessor introduced by Intel in 1976, utilizing N-MOS technology
Requires only a +5 volts power supply, unlike its predecessor the 8080
Microprocessor Architecture Overview
Accumulator
Registers
ALU (Arithmetic and Logic Unit)
Control Unit
Data Transfer Instructions
MOV: Move data between registers or memory locations
MVI: Move immediate data into a register or memory location
LXI: Load 16-bit immediate data into register pair
LDA: Load accumulator with data from a memory address
STA: Store accumulator content at a memory address
Arithmetic Instructions
ADD: Add contents of register/memory to the accumulator
SUB: Subtract contents of register/memory from the accumulator
INR: Increment the contents of a register/memory
DCR: Decrement the contents of a register/memory
ADC: Add register/memory contents to the accumulator with carry
SBB: Subtract contents of register/memory from the accumulator with borrow
Logical Instructions
AND: Perform bitwise AND operation with accumulator
ORA: Perform bitwise OR operation with accumulator
XRA: Perform bitwise XOR operation with accumulator
CMP: Compare accumulator with register/memory
CMA: Complement accumulator
Branching Instructions
JMP: Jump to a specified memory address
JC: Jump if carry flag is set
JNC: Jump if carry flag is not set
JZ: Jump if zero flag is set
JNZ: Jump if zero flag is not set
Input/Output Instructions
IN: Input data from specified port address into accumulator
OUT: Output data from accumulator to specified port address
Control Instructions
NOP: No operation
HLT: Halt the microprocessor
EI: Enable interrupts
DI: Disable interrupts
Addressing Modes
Immediate Addressing
Direct Addressing
Indirect Addressing
Register Addressing
Indexed Addressing
Relative Addressing
8051 Microcontroller
Single-chip microcontroller introduced by Intel in 1980
Features an 8-bit CPU, separate Program Memory (ROM) and Data Memory (RAM), along with Special Function Registers (SFRS)
Simple architecture, widely used in embedded systems due to its large instruction set and wide availability
Groups of Instructions for 8051 Microcontroller
Arithmetic Instructions
Branch Instructions
Data Transfer Instructions
Logic Instructions
Bit-oriented Instructions
Arithmetic Instructions for 8051 Microcontroller
ADD A, #data: Adds immediate data to the accumulator
SUBB A, #data: Subtracts immediate data from the accumulator with borrow
INC A: Increments the accumulator
DEC A: Decrements the accumulator
Branch Instructions for 8051 Microcontroller
AJMP addr11: Absolute jump to specified address
SJMP rel: Short jump (relative)
JZ rel: Jump if accumulator is zero
JNZ rel: Jump if accumulator is not zero
Data Transfer Instructions for 8051 Microcontroller
MOV A, #data: Move immediate data to accumulator
MOV Rn, A: Move accumulator to register
MOV direct, A: Move accumulator to RAM location
MOV A, direct: Move data from RAM location to accumulator
Logic Instructions for 8051 Microcontroller
ANL A, #data: Performs bitwise AND operation between immediate data and accumulator
ORL A, direct: Performs bitwise OR operation between accumulator and data at a RAM location
XRL A, #data: Performs bitwise exclusive OR operation between immediate data and accumulator
CPL A: Complements the bits of the accumulator
Addressing Modes for 8051 Microcontroller
Immediate Addressing
Register Addressing
Direct Addressing
Indirect Addressing
Indexed Addressing
Microprogramming
Technique for implementing control logic of a processor's instruction execution by breaking down complex instructions into simpler microinstructions stored in control memory
Components: Control store, control sequencer, and control logic
Pros: Offers flexibility, simplification, and ease of debugging
Cons: Incurs performance overhead and increased complexity compared to hardwired control
Microprogramming Overview
Shortening ROM words has drawbacks: Requires multiple ROM words for a sequence, increases decoding levels and ROM accesses, slowing down implementations
Designers often prefer vertical microcode despite inefficiencies due to its similarity to assembly language
Branch Jump Microwords
Include fields for: Selecting a signal for testing, Specifying the value for comparison, Determining the next ROM word based on the condition
Register Transfer/Operation Microword
Contains three fields: Register source, Register destination, Operation field for functional units like the ALU
Microoperations Categorization
Sources: PC, IR, MBR, AC, MAR, Bus MBR, Result
Destinations: RBUS, MBUS, IR, MAR, Mem Data Bus
Operations: ALU ADD, ALU PASS B, O → PC, PC + 1 → PC, Read/Write
Microprogramming Encoding
Nine sources encoded in a 4-bit field, Seven destinations encoded in 3 bits, Six operations encoded in 3 bits
Optimization opportunities exist in encoding destinations, saving ROM bits
As more control signals are encoded in ROM, the format shifts from horizontal to vertical
Three Levels of Programming Language
Machine Language Programming
Assembly Language
High-Level Language
Machine Language Programming
Lowest level of programming using binary codes directly understood by microprocessor, each representing a specific operation like addition or data movement
Assembly Language
Programming language using mnemonic codes to represent machine language instructions, making programming more manageable and human-readable
High-Level Language
Abstract and user-friendly programming languages allowing programmers to write code using natural language constructs like loops, conditionals, and functions
Examples of High-Level Languages
C
C++
(widely used for microprocessors and microcontrollers)
Python (popular for microcontrollers with Python interpreters)
Java (utilized in microcontrollers with virtual machines)
BASIC (used for some microcontrollers, especially those with BASIC interpreters)
Verilog (a hardware description language used for designing and verifying digital circuits)
VHDL (another hardware description language used for designing and verifying digital circuits)
Examples of Specialized Programming Languages
SPIN (used for Parallax Propeller microcontroller)
Forth (stack-based language)
LUA (lightweight language used for some microcontrollers, especially those with limited resources)
Microcontroller-Specific Languages
Arduino (C-based)
MicroPython (Python-based)
PICBASIC (BASIC-based)
AVR-GCC (C-based)
Keil μVision (C-based)
Programming Steps for Microprocessors
Understanding the Microprocessor Architecture
Defining the Problem
Designing the Algorithm
Writing the Code
Assembling and Simulating the Code
Testing and Debugging
Optimizing the Code
based language
Used for programming ARM-based microcontrollers
Programming Steps for Microcontrollers
1. Understanding the Microcontroller Architecture
2. Defining the Problem
3. Designing the Algorithm
4. Writing the Code
5. Assembling and Simulating the Code
6. Testing and Debugging
7. Optimizing the Code
Understanding the Microcontroller Architecture
Knowing about the registers, memory map, and available instructions
Defining the Problem
Clearly define the problem you want to solve with the microcontroller
Designing the Algorithm
Break down the problem into smaller steps and design an algorithm to solve it