Lec 02

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Microprocessor Systems

Lecture 02

8085 Microprocessor

1
Intel 8085 CPU

• Introduce on March 1976

• 8-bit microprocessor

• 3 MHz (maximum)

• 64K byte addressable memory

2
Intel 8085 CPU

3
8085 Pin layout

4
8085 Pin layout

• It has 40 pins and uses +5V for


power.
• The pins on the chip can be grouped
into 6 groups:

1- Address Bus. (16 ; A0 – A15)


2- Data Bus. (8 ; D0 – D7)
3- Control and Status Signals.
4- Power supply and frequency.
5- Externally Initiated Signals.
6- Serial I/O ports. 5
Microprocessor word
• Microprocessor word (or word length) is defined
as the number of bits the microprocessor
recognizes and processes at a time.

• Another term commonly used to express word


length is byte

• 8085 word length is 8 bits (8-bit microprocessor)


6
Microprocessor clock
• The 8085 microprocessor is a clock-driven
semiconductor device consisting of electronic
logic circuits that need clock pulse to
synchronize these various logic circuits.
• All microprocessor instructions are executed
with a certain number of clock pulses, so the
clock frequency determines processor speed.
• The maximum clock frequency that the
processor can run with is an important attribute.
7
Intel Microprocessor; Historical perspective

8
Intel 8085 Internal Structure

9
Registers

10
Accumulator-based ALU
• The accumulator is an 8-bit register that is part
of the arithmetic/logic unit (ALU).
• This register is used to store the 8-bit result data
performed by the ALU.
• Always one operand of the ALU operation is
placed in the accumulator, and the result is
placed back into the accumulator.
• The accumulator is also identified as register A.

11
General purpose Registers
• Six general purpose 8-bit registers: B, C, D, E, H,
and L

• They can also be combined as register pairs to


perform 16-bit operations: BC, DE, HL

• The programmer can use these registers to store


or copy data into/from the registers by using data
copy instructions. 12
Flags
• The ALU includes five flip-flops, which are
set or reset after an operation according to data
conditions of the result in the accumulator and
other registers.
• They are called Zero (Z), Carry (CY), Sign
(S), Parity (P), and Auxiliary Carry (AC) flags.
• These flags are contained in one 8bit register.

13
Flags
• The most commonly used flags are Zero, Carry,
and Sign. The microprocessor uses these flags
to test data conditions.

• These flags have critical importance in the


decision-making process of the microprocessor.
– E.g., the instruction JC (Jump On Carry) is
implemented to change the sequence of a program
when the CY flag is set.
14
Flags
• The following flags are set or reset after the
execution of an arithmetic or logic operation;
data copy instructions do not affect any flags.

– Z-Zero: The Zero flag is set to 1 when the result is


zero; otherwise it is reset.
– CY - Carry: If an arithmetic operation results in a
carry, the CY flag is set; otherwise it is reset.

15
Flags
– S - Sign: The Sign flag is set if bit D7 of the result =
1; otherwise it is reset.

– P - Parity: If the result has an even number of 1s, the


flag is set; for an odd number of 1s, the flag is reset.

– AC - Auxiliary Carry: In an arithmetic operation,


when a carry is generated by digit D3 and passed to
digit D4, the AC flag is set. This flag is used
internally for BCD (binary-coded decimal) operations;
there is no Jump instruction associated with this flag.
16
Flags
Instruction: ADD B

Register contents before Register contents after


instruction instruction:
A 9A h A 23 h

B 89 h B 89 h

Flag 80 h Flag 10 h

1001 1010
1000 1001 Note: All flags are
modified to reflect the
0010 0011
result of the addition.
Flag: S=0, Z=0, AC=1 , P=0 and C=1,
17
Program Counter (PC) and Stack
Pointer (SP)
• These are two 16-bit registers used to hold
memory addresses.
• PC:
– The function of the PC is to point to the
memory address from which the next byte is to
be fetched.

– When a byte (machine code) is being fetched,


the program counter is incremented by one to
point to the next memory location. 18
Program Counter (PC) and Stack
Pointer (SP)
• SP:
– It points to a memory location in R/W memory,
called the stack.

– The beginning of the stack is defined by


loading a 16-bit address in the stack pointer.

– The PC will automatically be updated when


calling to /returning from Subroutines.
19
Stack
• The stack is one of the most important things
you must know when programming.
– Think of the stack as a deck of cards. When you put a
card on the deck, it will be the top card. Then you put
another card, then another.
– When you remove the cards, you remove them
backwards, the last card first and so on.
– The stack works the same way, you put (push) words
(addresses or register pairs) on the stack and then
remove (pop) them backwards.
– That's called LIFO, Last In First Out.
20
• Temporary register- holds information from the
memory or register array. An input of the ALU.
• Instruction register (IR)– holds the operation
code of the currently executing instruction.

• Instruction Decoder (ID)- decodes the instruction.


Once decoded, the instruction controls the
remainder of the CPU, memory and IO through
the timing and control block.
• Control and Timing Unit- responsible of all
control and timing signals that manage internal
(inside the microprocessor) or external units. 21

You might also like