8085
8085
8085
Basic functions of the microprocessor, System bus, Architecture, Pin Configuration and Programmer s model of Intel 8085 Microprocessor. Overview of the instruction groups of 8085 and the addressing modes. (No programming based on 8085).
DATA BUS CONTROL BUS I/O PORTS OUTPUT DEVICES ADDRESS BUS CENTRAL PROCESSING UNIT (CPU) CONTROL BUS MEMORY (RAM & ROM)
INPUT DEVICES
CPU (central processing unit) ALU (arithmetic-logic unit) Control Logic Registers, etc Memory Input / Output interfaces
Consists of 16 address lines: A0 A15 Operates in unidirectional mode: The address bits are always sent from the MPU to peripheral devices, not reverse. 16 address lines are capable of addressing a total of 216 = 65,536 (64k) memory locations. Address locations: 0000 (hex) FFFF (hex)
Consists of 8 data lines: D0 D7 Operates in bidirectional mode: The data bits are sent from the MPU to peripheral devices, as well as from the peripheral devices to the MPU. Data range: 00 (hex) FF (hex)
Control Bus
Consists of various lines carrying the control signals such as read / write enable, flag bits.
Store 8-bit data (Registers, Accumulator) Perform arithmetic and logic operations (ALU) Test for conditions (IF / THEN) Sequence the execution of instructions Store temporary data in RAM during execution
Six general purpose 8-bit registers: B, C, D, E, H, L They can also be combined as register pairs to perform 16-bit operations: BC, DE, HL Registers are programmable (data load, move, etc.)
Accumulator
Single 8-bit register that is part of the ALU ! Used for arithmetic / logic operations the result is always stored in the accumulator.
Flag Register
S Z
AC
X P
Carry Parity
XUnspecified
The sign flag, S, indicates the sign of a value calculated by an arithmetic or logical instruction. The zero flag, Z, is set to 1 if an arithmetic or logical operation produces a result of 0; otherwise set to 0. The parity flag, P, is set to 1 if the result of an arithmetic or logical operation has an even number of 1s; otherwise it is set to 0. The carry flag, CY, is set when an arithmetic operation generates a carry out. The auxiliary carry flag, AC, very similar to CY, but it denotes a carry from the lower half of the result to the upper half.
Indicate the result of condition tests. Carry, Zero, Sign, Parity, etc. Conditional operations (IF / THEN) are executed based on the condition of these flag bits.
Contains the memory address (16 bits) of the instruction that will be executed in the next step.
All instructions (program steps) are stored in memory. To run a program, the individual instructions must be read from the memory in sequence, and executed.
Program counter puts the 16-bit memory address of the instruction on the address bus Control unit sends the Memory Read Enable signal to access the memory The 8-bit instruction stored in memory is placed on the data bus and transferred to the instruction decoder Instruction is decoded and executed
It takes four clock cycles to get one instruction into the CPU.
Execution of an Instruction
Now consider the execution of a simple instruction:
Instruction 3E (hex) means: Load a data byte into the accumulator The instruction is followed by the data byte 32 (hex) Two-byte instruction !
Execution of an Instruction
Execution of an Instruction
Execution of an Instruction
Execution of an Instruction
Execution of an Instruction
Execution of an Instruction
Execution of an Instruction
How long does it take to execute this two-byte instruction (op-code) ?
It is quite possible to accurately predict the time that is required to run each instruction, and to run the entire program !
Arithmetic operations (ADD, SUB, INR, DCR) Logic operations Branching operations (JMP, CALL, RET)
Load register A (accumulator) with 32 (hex) Load register B with 48 (hex) Add the two numbers and save the sum in A Display accumulator (A) contents at port (01) End
Instruction Set
y y y Data movement instructions Data operation instructions Program control instructions
r, r1, r2 any 8-bits register + / M[+] memory location rp register pair BC, DE, HL, SP(Stack pointer) n 8-bit address or data value
CY carry flag
cond conditional instructions NZ (Z = 0) Z (Z = 1) P (S = 0) N (S = 1) PO (P = 0) PE (P = 1) NC (CY = 0) C (CY = 1) Z zero flag, S sign flag, P parity flag, C carry flag
Note:
Each instruction is having an 8-bit instruction code.
Some instructions have fields to specify registers, while others are fixed.
instruction stored in memory: 25th byte 25: 00xxx110 (MVI r) 26th byte 26: xxxx xxxx (low-order memory)
instruction stored in memory: 25th byte 25: 00rp 0001 (LXI rp) 26th byte 26: xxxx xxxx (low-order memory) 27th byte 27: yyyy yyyy (high-order memoy)
instruction stored in memory: 25th byte 25: 0000 0001 (MOV) 26th byte 26: xxxx xxxx (specifies r1) 27th byte 27: yyyy yyyy (specifies r2)
Example program using 8085 microprocessor coding The Algorithm of the program 1: total = 0, i = 0 n + (n - 1) + + 1 2: i=i+1 3: total = total + i 4: IF i { n THEN GOTO 2The 8085 coding of the program LDA n i=n MOV B, A XRA A Loop: ADD B DCR B JNZ Loop STA total sum = A A = 0 sum = sum + i i=i-1 IF i { 0 THEN GOTO Loop= sum total