EC2304 Microprocessors and Its Applications: Unit I 8085 CPU 9
EC2304 Microprocessors and Its Applications: Unit I 8085 CPU 9
com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
AIM
OBJECTIVES
To introduce the architecture and programming of 8085 microprocessor.
To introduce the interfacing of peripheral devices with 8085 microprocessor.
To introduce the architecture and programming of 8086 microprocessor.
To introduce the architecture, programming and interfacing of 8051 micro controller.
TEXT BOOKS
1. Ramesh S Gaonkar, Microprocessor Architecture, Programming and application with 8085, 4 th
Edition, Penram International Publishing, New Delhi, 2000. (Unit I, II)
2. John Uffenbeck, The 80x86 Family, Design, Programming and Interfacing, Third Edition.
Pearson Education, 2002.
3. Mohammed Ali Mazidi and Janice Gillispie Mazidi, The 8051 Microcontroller and Embedded
Systems, Pearson Education Asia, New Delhi, 2003. (Unit IV, V)
REFERENCES
1. A.K. Ray and K.M.Burchandi, Intel Microprocessors Architecture Programming and Interfacing,
McGraw Hill International Edition, 2000
2. Kenneth J Ayala, The 8051 Microcontroller Architecture Programming and Application, 2nd
Edition, Penram International Publishers (India), New Delhi, 1996.
3. M. Rafi Quazzaman, Microprocessors Theory and Applications: Intel and Motorola prentice Hall
of India, Pvt. Ltd., New Delhi, 2003.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
1. What is microprocessor?
3. What is Accumulator?
The Accumulator is an 8-bit register that is part of the 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.
S Z AC P CY
S- Sign flag. This flag is set when the result of operation is negative number.
Z- Zero flag. This flag is set when the result of operation is zero.
AC- Auxiliary carry flag. In an arithmetic operation, when a carry is generate
by digit D3 and passed onto digit D4 .
P- Parity flag. After an arithmetic or logical operation, if the result has an
even Number of 1‟s, the flag is set.
CY- Carry flag. If an arithmetic operation results in a carry, then the carry
flag is set.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
RESET OUT: this signal indicates that the microprocessor is being reset. The
signal can be used to reset other devices.
READY: this signal is used to delay the microprocessor read or write cycles
until a slow responding peripheral is ready to send or accept data. When this
signal goes low, the microprocessor waits for an integral number of clock
cycles until it goes high.
RESET IN: When the signal on this pin goes low, the program counter is set
to zero, the buses are tri-stated and microprocessor is reset.
IO/ M: This is a status signal used to differentiate between I/O and memory
S0, S1: These signals can identify various operations opcode fetch, memory
read etc.
ALE- Address Latch Enable: This is a positive going pulse generated every
time when the 8085begins an operation. It indicates that the bits on AD0 –
AD7 are address bits.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
13. Explain the operation performed by 8085 when the following instructions are
executed?
a. SBB C b. RRC
SBB C: The contents of C register and carry flag are subtracted from the
Accumulator content. The result is stored in the Accumulator.
RRC: The Accumulator content is rotated to the right side by one position.
The bit D0 is shifted to both carry and D7.
carry
D7 D6 D5 D4 D3 D2 D1 D0
D0 D7 D6 D5 D4 D3 D2 D1 D1
14. Explain the operation performed by 8085 when the following instructions are
executed?
a. LDAX B b. XTHL
LDAX B: This instruction copies the data from the memory location
specified by BC pair into Accumulator.
XTHL: This instruction exchanges the memory location pointed by stack
pointer with the contents of L register and the contents of the next memory location
with the H register.
15. Explain the various steps involved when executing CALL instruction.
The Call instruction is used to transfer the program control to a subroutine
or Subprogram. There are 4 internal steps are performed when this instruction is
executed.
CALL 16 bit addr: This instruction transfers the program sequence to a subroutine
address unconditionally. The internal operations performed are:
i. saves the contents of program counter on stack.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
28. Write the machine cyles and no. of T-states for the given instructions.
i. IN 01H ii. STA 5000 H
Instruction Machine cycles Total no. of T-states
IN 01 H: 1. opcode fetch(4T)
2. Memory read(3T) 10
3. I/O read(3T)
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
34. What are the different ways to disable the interrupt processs?
The entire interrupt process is disabled by resetting the interrupt enable
flip-flop. The flip-flop can be reset in one of 3 ways.
i. Instruction DI
ii. System Reset
iii. Recognition of an interrupt request
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
39. Calculate the time delay for the program given below, when clock period =
0.5µs.
MVI C, F0 H
LOOP: DCR C
JNZ LOOP
No. of T states
MVI C, EF --- 7 T states
LOOP: DCR C --- 4 T states
JNZ LOOP --- 10 / 7 T states
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
2. Define Baud.
The rate at which the bits are transmitted, bits per second is called Baud.
8. What is USART?
It is a programmable device. Its function and specification for serial I/O can
be determined by writing instructions in its internal registers. The Intel
8251A USART is a device widely used in serial I/O.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
000 = bit 0
000 = bit 1
000 = bit 2
000 = bit 3
000 = bit 4
000 = bit 5
000 = bit 6
000 = bit 7
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
0 1 0 AI X A A A
Al - Autoincrement flag
AAA – RAM Address
27. Write the features of RS-232.
It operates in single-ended mode.
The maximum cable length can be up to 50 feets.
Ti supports maximum data rate of up to 20 K.
It offers receiver input resistance in the range of 3kΏ to 7kΏ.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
35. What is the significance of end of conversion signal while interfacing A/D
Converter to a µp?
The end of conversion signal indicates that the A/D coversion is completed
so that microprocessor can read digital data from ADC.
36. What is the internal operating frequency of 8279? How can you derive it from
Clock signal?
All timing and multiplexing signals for 8279 are generated by an internal
Prescaler. This prescaler divides the external clock by a programmable integer
Value given in the programclock command word, to generate internal frequency.
The format of program clock command word is
0 0 1 P P P P P
Where PPPPP determine the value of integer ranges from 2 to 31. To give
proper Scan and key debounce times, the internal frequency should be 100 kHz.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
37. Find the program clock command word if external clock frequency is 2 MHz.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
AX AH AL
BX BH BL
CX CH CL
DH DL
DX
CS
SS
DS Segment registers
ES
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
IP, BP and SP are the pointers and contain offsets within the code, data and
stack segments respectively. SI and DI are the index registers, which are used as
general purpose registers and also for offset storage in case of indexed, based
indexed and relative based indexed addressing modes.
SP
BP
SI
DI
IP
Pointers and index registers
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
ii. Allows the placing of code, data and stack portions of the same
program in different parts of memory for data and code protection.
iii. Permits a program and/or its data to be put into different areas of
memory, each times program is executed i.e., provision for
relocation may be done.
11.What is pipelining ?
Fetching the next instruction while the current instruction executes is
called pipelining.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
U U U U OF DF IF TF SF ZF U AF U PF U CF
U-Undefined
CF - Carry flag
PF - Parity flag
AF - Auxiliary flag
ZF - Zero flag
SF - Sign flag
TF - Single step trap flag
DF - Direction flag
IF - Interrupt enable flag
OF - Overflow flag
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
25.What will happen when a DMA request is made, while the CPU is performing
a memory or I/O cycles ?
When a DMA request is made, while the CPU is performing a memory
or I/O cycles, it will request the local bus during T4 provided:
i. The request occurs on or before T2 state of the current cycle.
ii. The current cycle is not operating over the lower byte of a word.
iii. The current cycle is not the first acknowledge of an interrupt
acknowledge sequence.
iv. A lock instruction is not being executed.
Symbol Description
ii. ALE Outputs a pulse at the beginning of the bus cycle and
to indicate an address available on address pins.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
29.What are the pins that are used to indicate the type of transfer in minimum
mode ?
The M/IO, RD, WR lines specify the type of transfer. It is indicated in
the following table:
M/IO RD WR
0 0 1 I/O Read
0 1 0 I/O Write
1 0 1 Memory read
1 1 0 Memory write.
S2 S1 S0
0 0 0 - Interrupt acknowledge
0 0 1 - Read I/O port
0 1 0 - Write I/O port
0 1 1 - Halt
1 0 0 - Instruction fetch
1 0 1 - Read Memory
1 1 0 - Write Memory
1 1 1 - Inactive.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
32.Draw the bus request and bus grant timings in minimum mode system.
CLK
HOLD
HLDA
CLK
RQ/GT
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
MOVDS, AX ; 2000H
MOV AX, [500H] ; Get first data byte from 0500H offset
ADD AX, [600H]; Add this to the second byte from 0600H
MOV [700H],AX; store AX in 0700H
HLT ; Stop.
36.What are the different types of addressing modes of 8086 instruction set ?
The different addressing modes are:
i. Immediate
ii. Direct
iii. Register
iv. Register indirect
v. Indexed
vi. Register relative
vii. Based indexed
viii. Relative based indexed
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
SS - 5000H
SP - 2050H
SS - 0101 0000 0000 0000
10H * SS - 0101 0000 0000 0000 0000
SP - 0010 0000 0101 0000
Stack- top 0101 0010 0000 0101 0000
Address 5 2 0 5 0
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
3. WHAT IS PSW?
Program status word (PSW) is the set of flags that contains the status information
and is considered as one of the special function register.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
hardware reset. The reset redefines all the SFRs but the RAM contents are left
unchanged.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
24. IF THE I/O PINS ARE ALWAYS BEING DRIVEN, HOW IS A LOGIC VALUE
READ FROM THE PIN?
When a “1” is loaded into the output flip-flop, the (weak) pull-up can be easily
over-powered by other logic drivers. Even if a pin does not have a pull-up (just the
open-drain driver), it is sufficient to have a “1” written to it. The transistor will be
off and the pin will float and can be driven by the external circuit.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
25. WHAT IS DONE TO REDUCE THE TIME TAKEN BY THE I/O PIN TO CHANGE
FROM LOW TO HIGH VOLTAGE VALUE?
To reduce the relatively long time to change from low to high voltage output, the
manufacturers provide high-current drivers on the I/O pins that drive high (without
pull-up) for two clock cycles. When using peripheral I/O devices, the pins are driven
high, rather than just pulled up.
27. WHAT ARE THE RULES FOLLOWED FOR INTERFACING I/O PIN TO
EXTERNAL DEVICES?
The few rules that have to be followed are:
i. Only use negatively active signals
ii. If a pin is not actively outputting a signal, set it high.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
37. WHAT ARE THE TWO DIFFERENT ELECTRICAL SIGNALS THAT CAUSE AN
INTERRUPT?
The two different electrical signals that cause an interrupt are:
I. Logic – 0 to Logic – 1 change known as transition activated interrupt.
II. Logic 0, Level activated interrupt.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
The register is used to enable or disable all 8051 interrupts and to selectively
enable or disable each of the five different interrupts.
EA: Disables all interrupts
Es: Enables or disable the serial port interrupt.
ET1: Enable or disable the timer 1 overflow interrupt.
EX1: Enable or disable external interrupt 1.
ET0: Enable or disable the timer 0 overflow interrupt.
EX0: Enable or disable external interrupt 0.
40. HOW IS THE 8051 SERIAL PORT DIFFERENT FROM OTHER MICRO
CONTROLLERS?
The 8051 serial port is a very complex peripheral and able to send data
synchronously and asynchronously in a variety of different transmission modes.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
I. The special function registers have addresses between 80H and FFH.
These addresses are above 80H, since the addresses 00 to 7FH are addresses of
RAM memory inside the 8051.
II. Not all the address space of 80 to FH is used by the SFR. The unused
locations 80Hto FFH are reserved and must not used by the 8051 programmer.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
76. WRITE A PROGRAM TO SAVE THE STATUS OF BITS P1.2 AND P1.3 ON RAM
BIT LOCATIONS 6 AND 7 RESPECTIVELY.
MOV C, P1.2 ; save status of P1.2 on CY
MOV O6, C ; save carry in RAM bit location 06
MOV C, p1.3 ; save status of p1.3 on CY
MOV 07, C ; save carry in RAM bit location 07.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
2. Draw the Pin Diagram of 8085 and explain the function of various signals.
Pin Diagram
Explanation about all signals
www.Vidyarthiplus.com
www.vidyarthiplus.com
DEPARTMENT OF ECE, ADHIPARASAKTHI COLLEGE OF ENGINEERING, KALAVAI.
10. With neat sketch explain the function of Programmable Interrupt Controller.
Block Diagram
Explanation about all blocks in the block diagram
11. With neat sketch explain the function of Keyboard and display controller.
Block Diagram
Types of Display Available
Types of keys available
Explanation about all blocks in the block diagram
15. Draw the Pin Diagram of 8051 and explain the function of various signals.
Pin Diagram
Explanation about all signals
www.Vidyarthiplus.com