Professional Documents
Culture Documents
COURSE NAME
LECTURE PERIODS PER WEEK
TOTAL PERIODS PER WEEK
CREDITS
: BECCEC502
: MICROPROCESSORS
: 05
: 05
: 05
18 Periods
8085 addressing modes instruction set classification and format stack and
subroutine assembly language programming.
UNIT - III : Intel 8086 Architecture and Programming
20 Periods
Intel 8086 architecture Pin description and function overview minimal &
maximum mode- bus activities during read / write operation Interrupts structure and its
operation. Instruction set addressing modes ALP comparative study of 286, 386,486 &
Pentium processors - Memory Protection and Virtual Memory Concepts.
UNIT - IV : Peripheral interface ICs & Serial communication.
22 Periods
Address space partitioning memory and I/O interfacing PPI 8255- UART -82518253 Timer 8259 A interrupt controller- 8237 programmable DMA 8279 keyboard and
display interface controller, 8087 numeric processor.
Buses: I2C, USB, field Bus, CAN, Profi Bus, IEEE 488.
Text Books :
1. Krishna kant Microprocessor and microcontrollers, PHI, 2007.
2. Barry B. Brey The Intel Microprocessors: Architecture, Programming and
Interfacing 4th ed., PHI, 2005.
3. Douglas V. Hall Microprocessors and Interfacing Programming and Hardware 2/e - Tata McGraw Hill, 2003.
Suggested Readings:
1. Ramesh S. Gaonkar Microprocessor Architecture, Programming and Applications
with the 8085 Penram International, 5th Ed, 2006.
2. A.P. Mathur Introduction to Microprocessors TMH, (3/e), 2006.
3. Walter A.Triebel, Avtar Singh, The 8088 & 8086 Microprocessor Programming,
Interfacing, software, Hardware and applications,4th ed., Pearson, 2004.
WR (Output 3state)
WRITE; indicates the data on the Data Bus is to be written into the selected memory
or I/O location. Data is set up at the trailing edge of WR. 3stated during Hold and Halt
modes.
CLK (Output)
Clock Output can be used as a clock i/p for other systems.
X1, X2 (Input)
Crystal or R/C network connections to set the internal clock generator. X1 can also be
an external clock input instead of a crystal. The input frequency is divided by 2 to
give the internal operating frequency.
________
RESET IN (Input)
Reset sets the Program Counter to zero and buses are tri stated and CPU is held in the reset
condition as long as Reset is applied.
RESET OUT (Output)
Indicates CPU is being reset. It can be used to RESET other system.
HOLD (Input) - DMA
HOLD; indicates that another Master is requesting the use of the Address and Data
Buses.
HLDA (Output) - DMA
HOLD ACKNOWLEDGE; indicates that the CPU has received the Hold request and
It is willing to serve the request.
INTERRUPT PINS:
INTR (Input), TRAP (Input), RST 5.5 (Input), RST 6.5 (Input), RST 7.5 (Input)
INTA (Output).
Vcc - +5 volt supply.
Vss - Ground.
2. Architecture Description:
Registers
The 8085 has six general-purpose registers to store 8-bit data; these are identified as
B,C,D,E,H, and L. They can be combined as register pairs - BC, DE, and HL - to perform
some 16-bit operations. The programmer can use these registers to store or copy data into
the registers by using data copy instructions.
Accumulator
The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This
register is used to store 8-bit data and to perform arithmetic and logical operations.
The result of an operation is stored in the accumulator. The accumulator is also
identified as register A.
Flags
The ALU includes five flip-flops, which are set or reset after an operation according
3
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. The
microprocessor uses these flags to test data conditions.
D7
D6
D5
D4
D3
D2
D1
D0
S
Z
AC
P
CY
Stack Pointer (SP)
The stack pointer is also a 16-bit register. It points to a memory location in R/W memory,
called the stack(TOP OF STACK). The beginning of the stack is defined by loading 16-bit
address in the stack pointer.
Internal Architecture
Program Counter (PC)
This 16-bit register deals with sequencing the execution of instructions. The function of the
program counter 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.
Instruction Register (IR):
It holds the opcode of the instruction which is being decoded & executed.
4
Temporary Register:
It is an 8-bit register associated with ALU. It holds the data during an arithmetic/logical
operation. It is used by the MPU & not accessible to the programmer.
Program Status Word (PSW):
It is a combination of Flag register & Acc.
T-State:
One T-state or state is referred to as one clock cycle of system clock. It is also a part of
operation performed in one clock cycle.
Machine cycle (MC):
The necessary steps carried out to perform a fetch, read or write operation constitute a
machine cycle. A MC consists of several T-states.
Instruction Cycle:
An instruction is a command given to the computer to perform a specified operation on the
given data. Program is a sequence of instructions to perform a task. Program & data are
stored in memory. The CPU fetches one instruction at a time from memory & executes it.
The necessary steps that a CPU carries out to fetch an instruction and necessary data from
memory, and to execute it constitute an instruction cycle. An instruction cycle consists of a
Fetch & Execute cycle.
Fetch cycle (FC):
In fetch cycle, the CPU fetches the opcode from the memory. In the begining of fetch cycle
the content of PC which is the address of memory location where the opcode is available, is
sent to memory. The memory places the opcode on the data bus so as to transfer it to the
CPU.
Execute cycle (EC):
The steps carried out to get data, if any, from the memory and to perform the operation
specified by the instruction constitute execution cycle. The opcode fetched from memory
goes to the data/address buffer and then to IR. From IR it goes to decoder circuitary which
decodes the instruction. After the decoding the execution begins.
Time required for FC is a fixed slot of time but the time for EC depends on type of
instruction to be executed. IC = FC + EC. An IC consists of several MC.
Instruction flow:
The word length of a computer or processor is the number of bits it handles at a time. For a
8-bit processor it is of one byte. Two kinds of words, namely instruction word (opcode) and
data word are processed during an instruction cycle. In the beginning of a fetch cycle the
content of PC is transferred to a special register called Memory Address Register, MAR
(Address buffer). The content of MAR is transferred to the memory through the address bus.
Using some control signal MPU tells that it wants to read the content of memory. Then the
memory sends the opcode to the MPU through the data bus. The opcode first comes in the
Memory Data Register, MDR (Data buffer). The opcode is then placed in the Instruction
register & decoded by the instruction decoder and it is executed. Finally, the content of PC is
incremented.
5
Instruction
Register
Instruction
Decoder
Control
MDR
Memory Data
Bus
Program
Counter
MAR
Memory
Adress Bus
Flow of Opcode
Data flow:
For the execution of most instruction, data flow is required. The data word received from the
memory or input device, flows to the processor through the data bus and is placed in the Acc
or any general purpose register depending upon the instruction. After the execution the result
is placed in memory or sent to an output device through data bus. When a data word is
written into memory, it is also held in MDR (Data buffer) until the write operation is
complete.
3. Addressing Modes:
It is the way by which the operand is specified in the instruction.
i. Immediate The operand is specified as a part of instruction itself.
ii. Direct The address location containing the operand is specified in the instruction
itself.
iii. Register Direct The register at which the operand is present is specified in the
(or) Register
instruction.
iv. Register Indirect The address of the operand is specified by a register pair. In other
words, register pair, whose contents is the address location of the
operand is specified in the instruction.
v. Implicit The operand is implicitly specified in the instruction itself (default operand).
Instruction set classification
LDAX B/D
STAX B/D
LHLD Addr16
SHLD Addr16
LDA AddR16
STA Addr16
LXI Rp/SP
XCHG
ADD R/M
ADI 8-bit
DAD Rp/SP
ADC R/M
ACI 8-bit
DAA
SUB R/M
SUI 8-bit
SBB R/M
SBI 8-bit
iii. Logical Operations : These instructions perform various logical operations. Any 8-bit
number, or the contents of a register, or of a memory location can be logically ANDed, Ored,
or Exclusive-ORed with the contents of the accumulator. The results are stored in the
accumulator.
ANA R/M
ORA R/M
XRA R/M
STC
ANI 8-bit
ORI 8-bit
XRI 8-bit
CMC
Rotate- Each bit in the accumulator can be shifted either left or right to the next
Position.
RLC (without carry)
RAL (through carry bit)
RRC
RAR
Complement - The contents of the accumulator can be complemented. All 0s are
replaced by 1s and all 1s are replaced by 0s.
CMA
Compare- Any 8-bit number, or the contents of a register, or a memory location can
be compared for equality, greater than, or less than, with the contents of the accumulator.
CMP R/M
CPI 8-bit
iii. Branching Operations: This group of instructions alters the sequence of program
execution either conditionally or unconditionally.
Jump - Conditional jumps are an important aspect of the decision-making process in
the programming. These instructions test for a certain conditions (e.g., Zero or Carry
flag) and alter the program sequence when the condition is met. In addition, the
instruction set includes an instruction called unconditional jump.
JNZ
JNC
JP
JPO
PCHL
JZ
JC
JM
JPE
JMP Addr16
Call, Return, and Restart - These instructions change the sequence of a program
either by calling a subroutine or returning from a subroutine. The conditional Call and
Return instructions also can test condition flags.
CNZ
CNC
CP
CPO
CALL Addr16
CZ
CC
CM
CPE
RNZ
RZ
RNC
RC
RP
RM
RPO
RPE
RET Addr16
These instructions control machine functions such as Stack, Halt, Interrupt, or do nothing.
IN Addr8
PUSH Rp/PSW
XTHL
NOP
OUT Addr8
POP Rp/PSW
SPHL
HLT
DI
EI
RIM RST n
SIM RST 6.5
RST 5.5
RST 7.5
Note:
TRAP
Addr8 8 bit Port address
Rp B, D, H
n 0 TO 7
4. Stack:
The stack in 8085 microprocessor can be described as a set of memory locations in R/W
memory, specified by the programmer in the main program. These memory locations are
used to store data bytes temporarily during the execution of the program. The beginning of
stack can be defined in the program using the instruction LXI SP,16bit address which loads
the SP with the 16-bit address specified in the instruction. The stack in 8085 microprocessor
is a down growing stack which means, once the stack location is defined, storing of data
bytes begins at the memory location one less than the address in SP register and it can grow
till the lowest possible address location (0000H). The programmer can store & retrieve the
contents of a register pair using PUSH & POP instructions.
Subroutine:
A subroutine is a group of instructions written separately from the main program to perform
a function that occurs repeatedly in the main program. the 8085 microprocessor has two
instructions to implement subroutines: CALL (call a subroutine), and RET (return from
subroutine). When a CALL instruction is executed, the microprocessor automatically stores
the 16-bit address of the instruction next to CALL on the stack. Upon the execution of RET
instruction, the contents of the top two locations of the stack are transferred to PC. In other
words, CALL & RET instruction uses implicit PUSH & POP operations.
5. 8085 Interrupt Structure and Operation
8085 supports two types of interrupts: Hardware & Software.
Hardware Interrupts: interrupt signals generated by peripheral device through some pins
to interrupt the main program. 8085 has five hardware interrupts namely TRAP, RST 7.5,
RST 6.5, RST 5.5, INTR. The interrupts are arranged in a fixed priority that determines
which interrupt is to be recognized if more than one is pending as follows: TRAP highest
priority, RST 7.5, RST 6.5, RST 5.5, INTR lowest priority. The TRAP interrupt is useful for
catastrophic errors such as power failure or bus error. The TRAP input is recognized just as
any other interrupt but has the highest priority. The TRAP input is both edge and level
sensitive.
Trigger
Level & +VeEdge
+VeEdge
High Level
High Level
High Level
Vector Address
0x24
0x3C
0x034
0x02C
-
10
Instruction
LXI D
L1:DCX D
MOV A,D
ORA E
JNZ L1
No.of T-states
10
6
4
4
10 or 7
RET
10
Execution count
1
N
N
N
N-1 with 10
1 time with 7
Total T-state
10
6N
4N
4N
10N-10
7
10
JNZ instruction will take 10T when it makes jump and 7T when condition fails.
Time = 24N-17 T-states.
Example:
Required time delay = 10ms.
With clk of 3MHZ, time for 1 T-state is 1/3x106 = 0.33s.
T-states required to get 10ms delay
= 10ms / 0.33s
= 10x10-3 / 0.33x10-6
= 30303 = 765Fh.
11