MPMC Complete Note
MPMC Complete Note
& Microcontrollers
Contents:
MODULE-1: 8085 MICROPROCESSORS
1. INTRODUCTION:
2. IMPORTANT FEATURES OF 8085 MICROPROCESSORS:
3. PIN DIAGRAM OF 8085 MICROPROCESSORS:
4. PIN DESCRIPTION OF 8085 MICROPROCESSORS:
5. INTERNAL ARCHITECTURE OF 8085 MICROPROCESSORS:
6. INSTRUCTION SETS OF 8085 MICROPROCESSORS:
7. ADDRESSING MODE OF 8085 MICROPROCESSORS:
8. PROGRAMMING FOR 8085 MICROPROCESSORS
a) ASSEMBLY LANGUAGE FOR 8 BIT ADDITION:
b) ASSEMBLY LANGUAGE PROGRAMMING FOR 8 BIT ADDITION USING MEMORY LOCATION:
c) ASSEMBLY LANGUAGE PROGRAMMING FOR 8 BIT MULTIPLICATION RESULTING 16 BIT NUMBER:
d) ASSEMBLY LANGUAGE PROGRAMMING FOR DIVISION OF 8 BIT BY A 8 BIT NUMBER:
e) PROGRAM FOR FINDING THE SMALLEST NUMBERR FROM A GIVEN DATA:
f) PROGRAM TO FIND THE LARGEST NUMBER FROM A GIVEN DATA ARRAY:
g) PROGRAM FOR BINARY TO GRAY COAD CONVERSION:
9. TIMING DIAGRAM OF 8085 MICROPROCESSORS:
10. STACK AND SUBROUTIN:
11. MULTIPLE CHOICE QUESTION AND ANSWER:
12. ASSIGNMENT:
1. INTRODUCTION:
2. 8255 PPI (PROGRAMMABLE PERIPHERAL INTERFACE):
➢ PIN DIAGRAM OF 8255 PPI:
➢ PIN DESCRIPTION OF 8255 PPI:
➢ INTERNAL ARCHITECTURE OF 8255 PPI:
3. 8257 DMA (DIRECT MEMORY ACCESS):
➢ PIN DIAGRAM OF 8257 DMA:
TABLE OF CONTENT
1. INTRODUCTION:
2. PIN DIAGRAM OF 8051 MICROPROCESSORS:
3. PIN DESCRIPTION OF 8051 MICROPROCESSORS:
4. INTERNAL ARCHITECTURE OF 8051 MICROPROCESSORS:
5. INSTRUCTION SETS OF 8051 MICROPROCESSORS:
6. ADDRESSING MODE OF 8051 MICROPROCESSORS:
7. MULTIPLE CHOICE QUESTION AND ANSWER:
8. ASSIGNMENT:
MODULE-1:8085 MICROPROCESSORS
X1 & X2
• These are two external pins which are connected to an external crystal oscillator which
provides an internal clock frequency up-to 5MMHz to the processor so that the processor
takes about 0.2µsec to compute an instruction.
• Pin no-36 & 3 are used as RESET IN’ & RESET OUT’ respectively.
• These pins are basically used to restart the processor if the program hangs in between.
SOD
SID
TRAP
• Pin no-7, 8 & 9 are used as RST 7.5, RST 6.5 & RST 5.5 respectively.
• These are the maskable interrupt pins.
• Once this interrupt is activated the processor will stop the current program and jump to
some other program which is required at that specific moment of time and till the
completion of that specific program the processor return back to original program.
INTR
INTA’
• If the interrupt is activated then the processor will send an acknowledge message through
• Pin no-12 to pin no-19 are used as both data line and address line pin (AD0-AD7).
• Pin no-21 to pin no-28 are used as address line pin (A8-A15).
• That means in 8085 microprocessors have 8-bit data line and 16-bit address line.
VSS
S0 &S1
S1 S0 OPERATION
0 0 HALT
0 1 WRITE
1 0 READ
1 1 FETCH
ALE
WR’
RD'
IO/M’
READY
CLK
• Pin no-38 is used as HLDA and pin no-39 is used as HOLD pin.
• Once the HOLD pin is activated then the processor will not allow any external data to
interfere the current program and if the hold is successfully activated then the processor
will send an acknowledge message through the HLDA pin.
VCC
The total internal architecture of 8085 microprocessor can be divided into 3 major units they
are;
The main function of temporary register is to store the data temporary before the
data is transforming to ALU to performing different arithmetic and logically units.
B. Status flag:
The main function of status flag is to check the status of the output program or to
check whether the result is right or wrong. It consists of 8-bit out of which 5 are active
flags and three re undefined bits.
➢ Sine flag: After the arithmetic operation if the result is negative then sign
flag is tends to logic 1 otherwise it will tend to logic 0.
➢ Zero flag: After the arithmetic operation if the result is zero then zero flag
will tend to logic 1 otherwise it will tend to logic 0.
➢ Auxiliary flag: After the arithmetic operation if there is a carry from 3rd to
4th bit then auxiliary carry will tends to logic 1 otherwise it will tend to logic
0.
➢ Parity flag: After the arithmetic operation if the result of the sum contains
even no. of 1’s then parity flag will tend to logic 1 otherwise it will tend to
logic 0.
➢ Carry flag: After the arithmetic operation if the result is more than 8 bits
then there will be a carry from 7-8 bit so carry flag will tends to logic 1.
C. Accumulator:
The final result of arithmetic and logical operation is stored in accumulator.
register they are B, C, D, E, H, L and each register can store 8-bits of data individually that
means B can store 8-bit of data, C can store 8-bits of data and so on. But in pair form i.e. BC,
DE, HL ARE STORES 16-bits of data. This are known as general purpose register because in
most of the programming we use these registers commonly for storing 16-bits or 8-bits of
data.
Special purpose register
These are 16-bits registers which are used for some specific purpose. The special
purpose registers are:
A. Stack pointer
o Stack: Stack is a set of memory location whose address is different from
main memory. We can transfer the data from main memory to stack
memory by push instruction and we can retrieve the data from stack
memory to main memory by pop instruction. The data transform from main
memory to stack memory by FIFO (First in First Out) sequence and is retrieve
from stack memory to main memory by LIFO (Last in Last Out) sequence.
o To locate a particular memory address, we take the help of stack pointer
and is given by LXI SP, 9904- load the content of stack pointer into the
memory address 9904.
B. Program counter
o It holds the address of the next instruction or it checks whether the address
for next instruction is available or not.
C. Increment decrement latch
o It is basically used for increment and decrement operation.
Instruction: Instructions are set of command given to the processor to perform a specific
operation.
e.g. MVI A, 38
▪ Opcode: The first part of instruction which specifies some task we done by the processor.
Here MVI is the opcode which means move immediately the data.
▪ Operand:The second part of instruction which is basically used to store the data or to
perform a memory read or memory write operation.
✓ Memory read: When the data is transfer to accumulator then that is the memory
read operation.
✓ Memory write: When the data is transferred to some other memory address apart
from accumulator then that is memory write.
Instruction decoder: Its main function is to convert the mnemonics to its machine code.
Instructions are sets of commands given to the processor to perform a specific operation.
Each instruction can be defined into two parts one is the opcode and another is operand.
• According to word length: Word length means the no. of bits or bytes a specific
instruction occupies. Accordingly, there are 3-types i.e.1-byte, 2-byte, 3byte.
a) 1-byte: In 1-bytes instruction the opcode is define but the operand data is not
directly specified but is specified by some register.
e.g. ADD B- In this case the opcode is defined i.e. ADD which has got a machine
code of 8-bit, but the operand is specified by register so it is 1-byte instruction.
b) 2-byte: In 2-byte instruction opcode is present followed by 8-bit operand data.
e.g. MVI A, 30- In this case the opcode is defined i.e. MVI which has got a machine
code of 8-bit and the operand data is 30 which has the binary value 00110000 i.e.
8-bit. So, the total size is 16-bits and called 2-byte instruction.
c) 3-byte: In 3-byte instruction the opcode is present and followed by 16-bit operand
data.
e.g. STA 9100- In this case the opcode is defined i.e. STA which has got a machine
code of 8-bit and the operand data is 9100 which has the binary value
10 | P a g e
1001000100000000 i.e. 16-bit. So, the total size is 24-bits and called 3-byte
instruction.
• According to operation: according to the type of operation it performs the total
instruction sets can be classified into 5 different types, they are
a) Data transform instruction: It is basically used for transferring the data from one
register to another register or register to memory without changing the content.
E.g. MOV A, B-Move the content of B registers to accumulator.
MOV A,34H-Move the 8-bit data 34H to accumulator.
b) Arithmetic instruction: These are basically used for arithmetic operation such as
addition, subtraction, multiplication, division, increment, decrement etc. In this case
the final result may change.
e.g. ADD B- Add the content of register B with the accumulator.
c) Logical instruction: These instructions are basically used for logical operation
such as ANA (AND), ORA (OR), XRA (XOR), CMP (COMPARE) etc.
d) Branch control instruction: The instruction under this group are basically used
for conditional or unconditional jump operation.
E.g.
JNZ- Jump if the counter data in the register C is not zero to label loop.
JNC- Jump if there is no carry or borrow to label loop.
e) IO and machine control: The instruction under this group are basically used for
controlling the device or for transferring the data from one device to another
device or for set or reset of the status flag or for stack operation comes under this
group.
e.g. HALT (to stop the program)
INO2 (to receive the data from port 02)
OUT01 (to transfer data through port 01)
STC (set the carry flag to logic-1)
11 | P a g e
It is the technique through which we are specifying data for operation or how the operand data
is specified accordingly in 8086 microprocessors. There are 8 different addressing mode
according to the type of operation it performs.
END
RESULT:
In memory location 9105 =0F
In memory location 9106 =00
14 | P a g e
END
RESULT:
Quotient is in register= 03H
Remainder is in accumulator= 04H
15 | P a g e
DATA: RESULT:
In memory address 9101= 03H In memory address 9105= A5H
In memory address 9102= 98H
In memory address 9103= A5H
In memory address 9104= 29H
17 | P a g e
48 - 01001000
C - 01001000
STC - 101001000
CMC - 001001001
RAR - 0001001001
TIMING DIAGRAM
It is a graphical representation of instruction cycle or it shows how the control signals are
affected when we are performing an opcode operation r an execution operation.
Instruction cycle:
It is the total time required to read the opcode of an instruction from the memory and to
perform the execution operation.
▪ T2 & T3-state: During these states the hexadecimal code or the machine code of
an instruction is read from the memory.
▪ T4 state- This state is known as wait state or during this period the data is transferred
from the opcode fetch cycle to execution cycle.
o Execution cycle:
It is the total time required to perform the memory read or memory write operation.
In execution cycle the final result is stored so we do not require any wait state (time gap
for data overlap).
If the operand data is 8-bit then we required 3T states and if the operand data is 16-bit
then we required 6T states.
✓ During T1 state of execution cycle the address is read from the memory.
✓ During T2 & T3 states of execution cycle the operand data is read from the memory.
Q. If the external clock frequency is 5MHz then how much time the processor will take to
execute the operation
I. MVI A, 30
II. MOV A, B
III. LXI H, 9105
Stack: Stack is the sets whose address is different from main memory address. We can transfer
the data from main memory to stack memory by PUSH instruction and the data is transferred
in FIFO sequence and we can retrieve the data from stack memory to main memory by POP
instruction and the data is retrieve by LIFO sequence.
Q. Initialize the stack memory address 9906. Write a program to transfer the data from
main memory to stack & then retrieve it. Suppose the data contain in main memories are:
9101- 2050H, 9103- 3040H, 9105- 6070H.
Solution:
1. The 8085 Up is
A) 16 bit
B) 8 bit
C) 20 bit
D) 32 bit
Answer: B
2. The address line of 8085 up is
A) 16 bit
B) 8 bit
C) 24 bit
D) none of these.
Answer: A
3. The function of ALU is
A) Arithmetic operation
B) Arithmetic and logical operation
C) Logical operation
D) None of these.
Answer: B
4. The function of crystal oscillator
A) providing internal clock frequency
B) impedance matching
C) reducing speed
D) Disconnecting ports
Answer: A
5. The no. Of general-purpose register in 8085 up is
A) 6
B) 5
C) 4
D) 3
Answer: A
6. The no. Of addressing mode in 8085 up is
A) 5
B) 4
C) 3
D) 2
26 | P a g e
Answer: A
7. The no. Of instruction set in 8085 up is
A) 4
B) 3
C) 5
D) 2
Answer: C
8. The no. Of interrupt in 8085 up is
A) 5
B) 6
C) 7
D) 256
Answer: A
9. Timing diagram is
A) interfacing
B) connecting
C) Analyzing.
D) Graphical representation of instruction cycle
Answer: D
10. MVI A,30 is
A) Immediate addressing mode
B) Implicit
C) Direct
D) Indirect
Answer: A
11. The no. Of pin in 8085 up is
A) 40.
B) 30
C) 28
D) 32
Answer: A
12. The interrupt having highest priority is
A) TRAP
B) INTR
C) RST0
D) RST1
Answer: A
27 | P a g e
A) 4
B) 7
C) 10
D) None of these.
Answer: B
20. The instruction cycle consist of
A) opcode fetch cycle.
B) opcode fetch cycle and execution cycle.
C) execution cycle
D) None of these.
Answer: B
ASSIGNMENTFULL MARKS-100
SECTION-A
(ANSWER ALL QUESTIONS)
SECTION-B
a) What is interrupt operation? What are the different interrupt pins are in 8085
microprocessor and how they work?
b) Explain the status flag of the 8085 microprocessor.
c) What is timing diagram? Draw the timing diagram of MVI A, B.
d) Write a program to convert a binary code to gray code.
e) Explain the T-states in opcode fetch cycle and execution fetch cycle.
f) Explain some important features of 8085 microprocessor.
SECTION-C
MODULE-2:8086 MICROPROCESSORS
Important features of 8086 Microprocessor:
• It is a 16bit processor that means its data line is 16bit and address line is 20bit.
• It consists of 40 pin IC chip and operates at +5V DC.
• It can operate in 3 different clock frequencies i.e. 5MHz, 8MHz and 10MHz.
• It consists of 9 active status flags out of which 6 are conditional flag and 3 are
control flag.
8085 8086
GND
• There are two ground pins in the 8086, pin 1 and pin 20.
32 | P a g e
AD0 to AD19
• Pin no-2 to pin no-16 and pin no-39 are both used as data line and address line (AD0 to
AD15).
• Pin no-38 to pin no-35 are used only for the address line (AD16 to AD19).
NMI
INTR
CLK
RESET
READY
TEST'
• Normally the processor speed is fast and I/O device speed is slow. So, some time we are
transferring the data to the processor but the data does not reach to the processor. So,
in that case the processor goes to wait state and READY pin becomes LOGIC 0 or
deactivated so in that cases the TEST' pin becomes activated i.e. TEST'=0 and TEST=1.
So, the processor goes to wait state.
• Again, when the data reach the processor then READY pin becomes activated or tends to
LOGIC 1 and TEST' pin becomes deactivated i.e. TEST'=1 and TEST=0.
• READY pin is opposite of TEST' pin.
Total 8 pins, from Pin 24 to pin 31 work differently for different modes (maximum or minimum).
❖ Minimum mode
o For simple output operation the 8086 microprocessors can operate in minimum
mode and in that case the MN/MX’=1 i.e. MN’=1, MX=0, MX=0, where MN is
minimum mode and MX is maximum mode and, in that case, the minimum mode
pins get activated.
o The minimum mode pins are HOLD, HLDA, WR’, DT/R’, DEN’, ALE, INTR’,
M/IO’.
Pin no-30 is used as HLDA and pin no-31 is used as HOLD pin.
Once the HOLD pin is activated then the processor will not allow any external
data to interfere the current program and if the hold is successfully activated
then the processor will send an acknowledge message through the HLDA pin.
WR’
M/IO’
DT/R’
DEN’
ALE
INTA’
❖ Maximum mode
o For multipurpose operation when more than 1 IC chips are used then the 8086
o Maximum mode pins are QS1, QS0, S0’, S1’, LOCK’, RQ’/GT1, RQ’/GT0
▪ These are queue status signals and are available at pin 24 and 25. These
signals provide the status of instruction queue. Their conditions are shown
in the following table −
0 0 No operation
S2 S1 S0 Status
0 0 0 Interrupt acknowledgement
0 0 1 I/O Read
0 1 0 I/O Write
0 1 1 Halt
36 | P a g e
1 0 0 Opcode fetch
1 0 1 Memory read
1 1 0 Memory write
1 1 1 Passive
LOCK
▪ When this signal is active, it indicates to the other processors not to ask
the CPU to leave the system bus. It is activated using the LOCK prefix on
any instruction and is available at pin 29.
RQ/GT1 and RQ/GT0
▪ These are the Request/Grant signals used by the other processors
requesting the CPU to release the system bus. When the signal is received
by CPU, then it sends acknowledgment. RQ/GT0 has a higher priority than
RQ/GT1.
RD'
MN / MX'
BHE' / S7
• BHE' decides whether the data bus will carry 16-bit data or 8-bit data. When BHE’ is
enabled (i.e. 0), then the bus will carry 16-bit data, else only 8-bit data through the lower
order data bus lines. It is multiplexed with status pin S7.
VCC
The total internal architecture of 8086 microprocessor can be basically divided into two different
units.
o Its function is to receive 6 no. of 8bit data at a time and stores the data in it and
then this data can be transferred to execution unit for performing arithmetic
and logical operation i.e. execution operation.
o The data is received from IO device to the 6 bytes instruction queue in FIFO
sequence.
Segment register
• The execution unit receives the opcode of an instruction from the 6byte instruction
queue decodes it and perform the arithmetic and logical operation and stores the
result.
• The function of different units of execution units are
40 | P a g e
ALU
o It is basically used to perform the arithmetic and logical operation such as addition,
subtraction, multiplication, division, increment, decrement, comparison.
o After the arithmetic and logical operation, the result is check by the status flag.
Status Flag
o The status flags are basically used to check whether the result is writing or wrong.
o Accordingly, in 8086 microprocessor there are 9 active status flags out of which 6 are
conditional flag and 3 are control flag.
Conditional flag: Conditional flags are those where the output depends upon the
input. The conditional flags are Sign flag, zero flag, Auxiliary flag, Parity flag, Carry
flag and overflow flag.
➢ Sine flag: After the arithmetic operation if the result is negative then sign
flag is tends to logic 1 otherwise it will tend to logic 0.
➢ Zero flag: After the arithmetic operation if the result is zero then zero flag
will tend to logic 1 otherwise it will tend to logic 0.
➢ Auxiliary flag: After the arithmetic operation if there is a carry from 3rd to
4th bit then auxiliary carry will tends to logic 1 otherwise it will tend to logic
0.
➢ Parity flag: After the arithmetic operation if the result of the sum contains
even no. of 1’s then parity flag will tend to logic 1 otherwise it will tend to
logic 0.
41 | P a g e
➢ Carry flag : After the arithmetic operation if the result is more than 8 bit
then there will be a carry from 7-8 bit so carry flag will tends to logic 1 and
in case of 16 bit operation if there is a carry from 15 to 16 bit the carry flag
will tends to logic 1 otherwise it will tends to logic 0.
➢ Overflow flag: After the arithmetic operation if the result is more than 16
bits, in that case the data cannot be stored in accumulator or destination
register. So, in that case the overflow flag will tends to logic 1 otherwise it
will tend to logic 0.
Control flag: The control flags are basically used for control-oriented activity such
as to stop the program, set or reset the operation, status flag manipulation,
interrupt operation. So, in this case it is used for control-oriented activity and here
the output is does not depends upon input. The control flags are Directional flag,
Interrupt flag, Trap flag.
➢ Directional flag: In case of character or string operation in that case the
directional flag will tends logic 1 otherwise it will tend to logic 0.
➢ Interrupt flag and Trap flag: These two flags are basically used as
interrupt operation.
Resistors
o Since these registers are commonly used for storing the data temporarily for any
arithmetic and logical operation so these are known as general-purpose register.
Special purpose register: The special purpose registers are Stack pointer (SP),
Base pointer (BI), Source index register (SI), Destination index register (DI). These
are known as special purpose register because they are used for some specific
operation and these are 16-bit registers.
Instructions are sets of commands given to the processor to perform a specific operation
accordingly in 8086 microprocessor the total instruction set can be divided into 8 different types
according to type of operation it performs. The instructions are;
1. Data transform instruction: It is basically used for transferring the data from one
register to another register or register to memory without changing the content.
E.g. MOV AX, BX-Move the content of BX register to AX register.
MOV AX,1234H-Move the 16-bit data 1234H to AX register.
2. Arithmetic instruction: These are basically used for arithmetic operation such as
addition, subtraction, multiplication, division, increment, decrement etc. In this
case the final result may change.
3. Logical instruction: These instructions are basically used for logical operation
such as ANA (AND), ORA (OR), XRA (XOR), CMP (COMPARE) etc.
4. Branch control instruction: The instruction under this group are basically used
for conditional or unconditional jump operation.
E.g.
JNZ- Jump if the counter data in the register C is not zero to label loop.
JNC- Jump if there is no carry or borrow to label loop.
5. Iteration control instruction: These instructions are basically used in label
portion for loop operation.
E.g. LOOP, CALL, AHEAD, STOP.
6. Interrupt instruction : The instruction under this group are basically used for
interrupt operation that means to stop the current program and jump to some
other program which is required at the specific moment of time and after the
completion of that specific program the processor can again return back to the
original program and these are given by through certain software instruction such
as INT, INT0, INT1, INT2, INTR.
44 | P a g e
7. Processor control: The instruction under this group are basically used for status
flag manipulation and for machine control operation.
E.g. CLC- Clear the carry bit.
CLD- Clear the directional flag.
STC- Set the carry bit to logic 1.
STD- Set the directional to logic 1.
CMC- Complement of carry bit.
HALT
PUSH
POP
8. String instruction: String is a series of bytes or series of word stored in a
sequential memory location.
In 8085 microprocessor there are certain instructions which are basically used to
move or store a string of data bytes.
E.g. MOV S- Move the string (single bit).
MOV SP- Move the string of data bytes.
CMP S- Comparison of string.
CMP SP- Comparison of string of data bytes.
It is the technique through which we are specifying data for operation or how the operand data
is specified accordingly in 8086 microprocessors. There are 8 different addressing mode
according to the type of operation it performs.
1. Register addressing mode: In this type of addressing mode the operand data is not
directly specified in the instruction itself but it is specified by some register.
E.g. MOV AX, BX- Move the content of BX register to AX register.
MOV AH, AL- Move the content of AL register to AH register.
45 | P a g e
2. Immediate addressing mode: In this type of addressing mode the operand data is
directly specified in the instruction itself.
E.g. MOV AH, 08H- Move immediately the data 08H to AH register.
MOV AX, 1264H- Move the 16-bit data 1264H to AX register.
3. Direct addressing mode: In direct addressing mode the operand address is directly
specified in the instruction itself.
E.g.
MOV AX, [9000H]- Move the content of memory address 9000 H to AX register.
MOV BX, [9001H]- Move the content of memory address 9001 H to BX register.
4. Register indirect addressing mode: In this type of addressing mode the operand data
is not directly transferred to the accumulator; at first it stored in some memory address
and the transferred to the accumulator.
E.g. MOV BX, [9001]
MOV AX, BX
5. Base addressing mode: In this type of addressing mode the operand address is one of
the contents of base pointer or stack pointer. Basically, it stores the OFF-SET value of the
instruction pointer.
E.g. MOV BX, [9005H]- Move the content of the memory address 9005 H to BX
register base pointer.
6. Index addressing mode: It is basically used to store the string address or the end
address. The source index register is used to store the starting address and destination
index register is used to store the end address.
E.g.
MOV SI, [9000H]- Move the content of memory address 9000 H to the SI register.
MOV DI, [9005H]- Move the content of memory address 9000 H to DI register.
7. Base index addressing mode: In this mode the operand OFF-SET is the sum of the
content of base register or BX and index register SI or DI.
E.g.
MOV AX, [BX+SI]- Move the content of base pointer or stack pointer and the
source index value to AX register or accumulator.
MOV AX, [BX+DI]- Move the sum of the content of base register and destination
index register value to accumulator.
8. Base index and displacement: In this addressing mode the operand OFF-SET is the sum
of the content off base pointer + SI or DI + 8-bit or 16-bit displacement value.
E.g. MOV AX, [AX+SI+08H]
46 | P a g e
When the single processor is used, then the 8086 microprocessor operates in minimum mode
MN/MX’ tends to logic 1 i.e. MN=1, MX’=1, MX=0
So, for simple input output operation or when a single processor is used then the 8086
microprocessor operates in minimum mode and in that case the control signal pins which are
attach to minimum mode get activated. The control signal pins are RD’, WR’, ALE, IO/M’, HOLD,
HLDA, DEN’.
The different units which are attached to the minimum mode control pin to perform different
memory read and IO read, IO write operation is known as minimum mode configuration.
i. Latches:
• There are 2 to 3 latches are present and these latches are octal in nature that means
each latch can stores 8 bits of data so the two latches can store 16 bit of data and
3 latches can stores 20 bits of address.
• Latches are temporary storage device or flipflop
• The ALE signal is connected to the latches and its function is to separate the
address from address and data bus.
• The bus high enable pin is also attach to the latches and its main function is to
check the validity of address and the address and data line are also attached to
latches.
ii. Trans receiver:
• Trans receiver means transfer and reception of data.
• Through the trans receiver we can transfer the data from the processor to the IO
device and in that case the DT/R’ tends to logic 1 i.e. DT=1, R’=1, R=0.
• If DT/R’ tends to logic 0 then DT=0, R’=0, R=1 so read operation is perform i.e. data
is received from the IO device to processor.
• Data enable pin is also attached to the trans receiver and its main function is to
check the validity of the data.
iii. RAM:
• It is known as random access memory.
• Its temporary stores the data and it volatile in nature that means if the power supply
OFF the data gets deleted.
• Hera we can perform both read and write operation.
49 | P a g e
iv. EPROM:
• EPROM- Erasable Programmable Read Only Memory.
• It is non-volatile in nature and is used to stores the library function.
• It is only used for read operation.
v. IO device or peripheral device:
• It is basically used for providing input data to the processor.
• In minimum mode single processor is used so a single IO device is connected to
processor.
vi. Clock generator:
• It is basically used for providing input clock frequency to the processor so that we
can check how much time the processor will take to execute an operation.
• It can vary from 5MHz to 10MHz.
50 | P a g e
For multipurpose operation the 8086 microprocessors can operates in maximum mode and in
that case the MN/MX’ pin tends to logic 0 i.e. MN=0, MX’=0, MX=1.
In maximum mode operation multiple RAM, multiple ROM, multiple IO devices are attached to
the processor to perform different memory read and memory write and IO read and IO write
operation.
In maximum mode operation bus controller i.e. 8288 is used because the control signal which
are required to perform different read write operation such as RD’, WR’, IO/M’ are not available
in maximum mode. So, if we are using a bus controller then all the control signal which are
required to perform different read write operation are resent in this bus controller.
Through this bus controller we can connect to multiple or different RAM, ROM, IO devices to
perform different read write operation and this bus controller is indirectly control by the status
signal pin i.e. s0’, s1’, s2’ of maximum mode control pins.
S2 S1 S0 Status
0 0 0 Interrupt acknowledgement
0 0 1 I/O Read
0 1 0 I/O Write
0 1 1 Halt
1 0 0 Opcode fetch
1 0 1 Memory read
52 | P a g e
1 1 0 Memory write
1 1 1 Passive
The different units which are attached to the maximum mode pins to perform different read
write operations are
1. Multiple latches:
• Latches are temporary storage device and acts as a flipflop.
• Multiple latches are used to separately stores the address and the data.
2. Trans receiver:
• Basically, used for transfer and reception of data to multiple RAM, multiple ROM
and multiple IO devices.
3. 8288 bus controllers:
• These bus controllers are basically used for performing different read, write and IO
operation with the help of control signal such as MRDC’, MWTC’, IORC’, IOWC’ etc.
4. Multiple RAM:
• It is known as random access memory.
• Its temporary stores the data and it volatile in nature that means if the power
supply OFF the data gets deleted.
• Hera we can perform multiple read and write operation.
5. Multiple EPROM:
• EPROM- Erasable Programmable Read Only Memory.
• It is non-volatile in nature and is used to stores the library function.
• It is only used for multiple memory read operation.
6. Multiple IO devices:
• It is basically used for providing multiple input data to the processor.
53 | P a g e
7. Clock generator:
• It is basically used for providing input clock frequency to the processor so that we
can check how much time the processor will take to execute an operation.
• It can vary from 5MHz to 10MHz.
54 | P a g e
The 8086 gets the new values of CS and IP register from four memory addresses. When it
responds to an interrupt, the 8086 goes to memory locations to get the CS and IP values for
the start of the interrupt service routine. In an Interrupt Structure of 8086 system the first 1
Kbyte of memory from 00000H to 003FFH is reserved for storing the starting addresses of
interrupt service routines. This block of memory is often called the Interrupt Vector Table in
8086 or the interrupt pointer table. Since 4 bytes are required to store the CS and IP values
for each interrupt service procedure, the table can hold the starting addresses for 256 interrupt
service routines.
Each interrupt type is given a number between 0 to 255 and the address of each interrupt is
found by multiplying the type by 4 e.g. for type 11, interrupt address is 11 x 4 = 4410= 0002CH
Only first five types have explicit definitions such as divide by zero and non- maskable interrupt.
The next 27 interrupt types, from 5 to 31, are reserved by Intel for use in future microprocessors.
The upper 224 interrupt types, from 32 to 255, are available for user for hardware or software
interrupts.
56 | P a g e
Answer: A
7. The no. Of status flags in 8086 up is
A) 6.
B) 8.
C) 9.
D) 5.
Answer: C
8. The status flag of 8086 up is divided into.
A) conditional flag and control flag
B) conditional flag and trap flag.
C)conditional flag and interrupt flag.
D)control flag and interrupt flag.
Answer: A
9. The no. Of conditional flags are.
A)4.
B)5.
C)8.
D)6.
Answer: D
10. The no. Of control flags are.
A)3.
B)5.
C)6.
D)8.
Answer: A
11. The no. of interrupts in 8086 up is
A) 256
B) 255
C) 200
D) 5.
Answer: A
12. The NMI interrupt is
A) TYPE 2
B) TYPE 1.
C) TYPE 3
D) TYPE O.
Answer: A
59 | P a g e
ASSIGNMENTFULL MARKS-60
SECTION-A
SECTION-B
SECTION-C
a) Explain the internal architecture of 8086 microprocessor with suitable diagram. Write
a program to find smallest no. from data array using 8086 microprocessors.
OR
b) Explain the instruction set of 8086 microprocessors. Draw the timing diagram of read
cycle of minimum mode configuration for 1byte instruction.
62 | P a g e
• It matches the processor’s speed with IO device speed so that our data will not get loosed.
Normally the processor’s speed is fast and IO speed is low so if we are using an interfacing
device then it matches the processor speed with IO device speed.
• It obeys the ASCII (American Standard Code for Information Interchange) or alpha
numeric code.
• It acts as voltage regulator so that our appliance will not get brunt.
• Through the interfacing device instead of transferring the data directly to the processor
we can indirectly store in the interfacing device and we can transfer it to the processor.
So, in this way we can avoid over burden of the processor.
• Through the interfacing device we can connect multiple IO device so in this way we can
receive data from multiple IO devices and then we can transfer into the processor.
• The various interfacing devices are:
1. 8255 PPI (Programmable Peripheral Interface)
2. 8257 DMA (Direct Memory Access)
3. 8259 PIC (Priority Interrupt Controller)
4. 8251 USART (Universal Synchronous Asynchronous Receiver Transmitter)
63 | P a g e
Port: Out of 40 pins, 24 pins are used for ports. There are 3 ports through we can transfer and
receives data.
64 | P a g e
CS’: Pin no-6 is used as cheap selection pin. If CS’=0, CS=1, then the control signal pins are
get activated.
A1& A0: Pin no-8 & pin no-9 is used as A1&A0 respectively. These 2 pins are control signal
pins used for controlling the ports and modes operations.
VCC: Pin no-26 is used as supply pin. +5V DC is supply to the IC through V CC pin.
D0 to D7: Pin no-34 to pin no-27 is used as data line pins (D0 to D7) which is of 8-bits and
these pins are bidirectional through which we can transfer and receive the data.
Reset: Pin no-35 is used as reset pin. It is basically used to restart the processor.
a) Ports: In 8255 PPI there are 3 parts i.e. Port A, Port B & Port C and the port C is
also divided into 2 types i.e. Port C lower and Port C upper. Each port can transfer
or receive 8-bits of data and can operated in 3 different modes.
i. Mode-0: In this mode of operation there no combination of ports takes
place and all the ports behaves as simple input output ports i.e. Port A can
transfer individually 8-bit of data, Port B can transfer 8-bit of data and Port
C upper & Port C lower can transfer individually 4 bits of data.
65 | P a g e
ii. Mode-1: In this mode of operation there is combination of codes takes place
i.e. Port A combines with Port C upper and Port B combine with Port C lower
to transmit 12-bits of data. So, mode-1 is also known as “Handshaking
Mode”, where the combination of ports takes place.
iii. Mode-2: In this mode only Port-A get activated and all other ports get
deactivated so, Port A behaves as bidirectional port through which we can
transfer or receive the data. This port is controlled by group control that
means group controls Port A and Port C upper and the mode of operation.
Similarly, group control the Port B and Port C lower and mode of operation.
b) Data bus buffer: It is known as bidirectional that means it can transfer and receive
data and it consists of 8-bit of data.
c) Read write control logic section: It is basically use for controlling the ports and
mode of operation with the help of control word bit which is present inside the
66 | P a g e
read write logic section and these control word bits are connected to different
ports through which it controls the ports that means it can make any port as input
or output through the control word data which is of 8-bit.
Q. Make a control word bit for mode-0 operation where port A and port B behaves as
input port & port C upper and port C lower output port.
Ans.
7 6 5 4 3 2 1 0
1 0 0 1 0 0 1 0
= 92H
Q. Make a control word bit for mode-1 operation, port A input, port B output, port C
upper input, port C lower output.
Ans.
67 | P a g e
7 6 5 4 3 2 1 0
1 0 1 1 1 1 0 0
=BCH
Q. Make a control word bit for mode-2 operation port A behaves as input all other ports
are output ports.
Ans.
7 6 5 4 3 2 1 0
1 1 0 1 0 0 0 0
= D0H
68 | P a g e
• Pin no-1 and pin no-2 is used as IOR and IOW’ operation respectively.
69 | P a g e
• IOR is used for IO read from IO device and IOW’ is used for IO write for
transferring the data from the processor to the IO device.
• Pin no-3 and pin no-4 is used as memory read and memory write operation
respectively.
• If MEMR’=0 AND MEMW’=1 then memory read operation occurs.
• If MEMR’=1 and MEMW’=0 then memory write operation occurs.
MARK
READY
HLDA
ADSTB
AEN
HRQ
• Through this pin the request message for HOLD operation is send to the
processor.
CS’
• Pin no-11 is used as cheap selection pin. If CS’=0, CS=1, then the control
signal pins are get activated.
CLK
RESET
DACK’
• There are 4 DACK’ pin in 8257 DMA such as DACK’0(pin no-25), DACK’1(pin
no-24), DACK’2(pin no-14) and DACK’3(pin no-15)
• The use of DACK’ pin is to send an acknowledge message when the data is
successfully accepted by the processor.
DRQ
• There are 4 different DMA Request pin such as DRQ3(pin no-16), DRQ2(pin
no-17), DRQ1(pin no-18), DRQ0(pin no-19).
• Through these pin 4 different IO devices are connect to the IC chip.
GND
D0-D7
• Pin no-30,29,28,27,26,23,22,21 is used as D0, D1, D2, D3, D4, D5, D6, D7
respectively.
• These pins are data line pins which is of 8 bit and bidirectional in nature i.e.
it can transmit and receive the data.
71 | P a g e
VCC
A0-A7
• Pin no-32, 33, 34, 35, 37, 38, 39, 40 is used as A0, A1, A2, A3, A4, A5, A6, A7.
• These pins are address line pin which is unidirectional in nature.
TC
It is known as DMA (Direct Memory Access) because instead of transmitting the data directly to
the processor, we can indirectly store the data from different IO devices and then we can
transfer the data to processor to avoid over burden of the processor.
The total internal architecture of 8257/8237 DMA is basically divided into 5 different units
a) 4 Channel
• There are 4 channels I DMA through which we can connected to 4 different IO devices.
• Each channel has got 2 pins i.e. DQR pin and DACK’ pin.
b) Priority resolver
• The main function of priority resolver is to check which data has gone 1 st from 4 different
channels through FIFO sequence and then according to priority basis, the data is
transferred to the processor.
c) Data bus buffer
• It is bidirectional, through which we can transfer and receive 8 bits of data.
d) Read/write logic section
• It has the different control signal such as IOW’, IOR’ etc. through which it can perform
different read write operation.
e) Mode set and status word register
• This unit has got different control signal such as ADSTB pin, HLDA, RD’, WR’ etc. through
which it can control the device and can perform different memory read and memory write
operations.
73 | P a g e
CS’ PIN
WR’ PIN
RD’ PIN
D7-D0 PIN
• Pin no-4 to pin no-11 are used for data line pin i.e. D7-D0.
74 | P a g e
• The data line pins are of 8 bit and is bidirectional in nature i.e. we can transfer or receive
the data.
CAS PIN
GND
SP/EN’
INT PIN
IR0-IR7
A0 PIN
VCC
It is basically used for interrupt driven operation where a single 8259 PIC can receive 8 no. of
interrupt request from 8 different IO devices but in cascade form the interrupt label can be
increase to 64.
The total internal architecture of 8259 PIC can be divided into 4 different units. They are
D0-D7
• Pin no-27,28,1,2,5,6,7,8 is used as D0, D1, D2, D3, D4, D5, D6, D7 respectively.
• These pins are data line pin and bidirectional in nature.
RXD pin
78 | P a g e
GND pin
TXC’ pin
WR’ Pin
CS’ PIN
C/D’ pin
RD’
RXRDY
• TXRDY
• Pin no-15 is used as transmitter ready pin.
• It is an output pin and its function are to inform the processor that the transmitter buffer
is ready to transmit the data to the external IO device.
SYNDET/BRKDET
CTS’
TXE
TXD
CLK
RESET
DSR’
• It is an input pin and it is basically used to check whether the data is ready for receiving
at the modem unit.
DTS’
DTR’
RXD’
VCC
The 8251 USART receives parallel data from the processor and transfer it serially and also it
receives serial data from the IO device and transmit them parallelly to the processor.
The total internal architecture of 8251 USART can be divided into 4 different units such as
Q. Connect the 32Kbyte RAM with 8086 microprocessors in maximum mode with the
starting address from 60000H.
Solution:
Now 16 Kbytes= 16*1024= 24*210= 214 i.e. here 14 pins are used for address operation.
16kbyte= = 16*1024= 24*210= 214 i.e. here 14 pins are used for address operation and among
from rest 6pin, 5 (A19-A15 pins) are used for control signal and 1 (A0 pin) is used for even or
odd ram selection pin.
Q. Connect the 64Kbyte RAM with 8086 microprocessors in maximum mode with the
starting address from 00000H.
Solution:
Now 16 Kbytes= 32*1024= 25*210= 215 i.e. here 15 pins are used for address operation.
0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0FFFF 32K*
8
ODD
32kbyte= = 32*1024= 25*210= 215 i.e. here 15 pins are used for address operation and among
from rest 5 pin, 4 (A19-A16 pins) are used for control signal and 1 (A0 pin) is used for even or
odd ram selection pin.
Q. Using a 3:8 decoder interfaces a 32Kbyte RAM with 8086 microprocessors in minimum
mode with the starting address from 00000H.
Solution:
Now 16 Kbytes= 16*1024= 24*210= 214 i.e. here 14 pins are used for address operation.
16kbyte= = 16*1024= 24*210= 214 i.e. here 14 pins are used for address operation and among
from rest 6 pin, 5 (A19-A15 pins) are used for control signal and 1 (A0 pin) is used for even or
odd ram selection pin.
C) Unidirectional Mode
D) Wait Mode
Answer: A
6. In Mode 2 operation
A) Only port A behaves as bidirectional Mode
B) unidirectional Mode
C) wait Mode
D) Inactive Mode
Answer: A
7. 8255 PPI is known as programmable peripheral device because
A) It is an interfacing device
B) connecting ports
C) Through control word bit we can control the ports and Mode of
Operation.
D) connecting ports
Answer: C
8. If control word bit is 80 H then it operates in
A) Mode 0
B) Mode 1
C) Mode 2
D) Mode 3
Answer: A
9. In 8257 DMA there are
A) 2 channel
B) 1 channel
C) 3 channel
D) 4 channel.
Answer: D
10. The FIFO sequence
A) The data which has come first will transfer first.
B) The data which has come first will transfer last.
C) Fixed data transfer.
D) Rotating data transfer
Answer: A
11. The function of priority resolver is
A) The data having highest priority.
B) lowest priority.
C) interfacing
87 | P a g e
B) 28
C) 30
D) 40
Answer: D
25. If the control word bit is 98H then 8255 PPI will operate in
A) Mode 2
B) Mode 3
C) Mode 1
D) Mode 0
Answer: D
26. If the control word bit is (BC)H the 8255 PPI will operate in
A) Mode 0
B) Mode 1
C) Mode 2
D) none of these
Answer: B
27. If the control word bit is (DO)H then 8255 PPI will operate in
A) Mode 2
B) Mode 1
C) Mode 3
D) none of these
Answer: A
28. Microprocessor is used for
A) program oriented
B) interfacing
C) control oriented
D) none of these
Answer: A
29. The function of latches
A) storing result
B) connecting ports
C) Data
D) Data and address
Answer: D
30. In synchronous data transfer the data transfer rate is more than
A) 10 kbps
B) 15 kbps
C) 20 Kbps
90 | P a g e
D) 5 kbps
Answer: C
ASSIGNMENTFULL MARKS-100
SECTION-A
SECTION-B
h) Make a control word bit for mode o and mode 1 operation where port A behaves as input
port, port B as output port, port Cupper as input and port Clower output.
SECTION-C
d)
MODULE-4:8051 MICROCONTROLLER
92 | P a g e
Microcontroller is like a mini computer with a CPU along with RAM, ROM, serial ports, timers,
and IO peripherals all embedded on a single chip. It’s designed to perform application specific
tasks that require a certain degree of control such as a TV remote, LED display panel, smart
watches, vehicles, traffic light control, temperature control, etc. It’s a high-end device with a
microprocessor, memory, and input/output ports all on a single chip. It’s the brains of a
computer system which contains enough circuitry to perform specific functions without external
memory. Since it lacks external components, the power consumption is less which makes it ideal
for devices running on batteries. Simple speaking, a microcontroller is complete computer
system with less external hardware.
It basically consists of 40 pin IC chip and operates at 12MHz clock frequency and supply voltage
is +5V DC.
MICROPROCESSOR MICROCONTROLLER
1. A microprocessor is a general- 1. A microcontroller is a dedicated
purpose device which is called a chip which is also called single
CPU. chip computer.
2. It is basically used for program- 2. It is basically used for control-
oriented activity. oriented activity or controlling
3. We have to attach external RAM, the device.
ROM, oscillator with 3. Microcontroller consists of
microprocessor. microprocessor and all other
4. Microprocessors are most units such as RAM, ROM, input
commonly used as the CPU in crystal oscillator etc. for
microcomputer systems. complete input output
5. Microprocessor instructions are operation.
mainly nibble or byte 4. Microcontrollers are used in
addressable. small, minimum component
designs performing control-
oriented applications.
5. Microcontroller instructions are
both bit and byte addressable.
Pins 1 to 8: These pins are known as Port 1. This port doesn’t serve any other functions. It is
internally pulled up, bi-directional I/O port.
Pin 9: It is a RESET pin, which is used to reset the microcontroller to its initial values.
Pins 10 to 17: These pins are known as Port 3. This port serves some functions like interrupts,
timer input, control signals, serial communication signals RXD and TXD, etc.
Pins 18 & 19: These pins are used for interfacing an external crystal to get the system clock.
Pin 20: This pin provides the power supply to the circuit.
Pins 21 to 28: These pins are known as Port 2. It serves as I/O port. Higher order address bus
signals are also multiplexed using this port.
Pin 29: This is PSEN pin which stands for Program Store Enable. It is used to read a signal from
the external program memory.
Pin 30: This is EA pin which stands for External Access input. It is used to enable/disable the
external memory interfacing.
94 | P a g e
Pin 31: This is ALE pin which stands for Address Latch Enable. It is used to demultiplex the
address-data signal of port.
Pins 32 to 39: These pins are known as Port 0. It serves as I/O port. Lower order address and data bus
signals are multiplexed using this port.
Pin 40: This pin is used to provide power supply to the circuit.
The total internal architecture of 8051 microcontroller basically consists of following units such
as
95 | P a g e
1. RAM
• It consists of 128 bytes of RAM out of which 32 bytes are used for register bank
selection.
• There are 4 register banks i.e. Bank-0, Bank-1, Bank-2, Bank-3 and these register banks
can be selected with the help of status control word i.e. RS0 and RS1 which is present
inside the status flags 8051 microcontroller.
• So, with the help of logic bits we can select a particular register bank and the mode
of operation.
2. ROM
• it is basically used to store the predefine data or library function and its memory
capacity is 4kB.
3. CLK frequency / Oscillator
• Inbuilt crystal oscillator is present inside the microcontroller which provide internal
CLK frequency up-to 12MHz.
4. Ports
• There are 4 ports such as Port-0, Port-1, Port-2, Port-3 and each port can transfer and
receives 8-bit of data.
• It is a connecting point or interface between the processor and the external device.
5. Timer and counter
• There are 2 timers i.e. timer-0 and timer-1 which consists of 16 bits registers and is
basically used for time delay operation and providing a matching clock frequency.
6. Processor
• It is basically used for arithmetic ad logical operation and for storing the result, to the
processor status flag is attached which is basically used to check the status of the
output program or for checking the result.
• In 8051 microcontroller the status flag consists of 8-bits out of which 6 are define and
2 are undefined pins.
• The defined pins are Carry flag, Auxiliary carry, RS0, RS1, Overflow flag, Parity flag.
• RS0& RS1 are basically used for register bank selection or for selecting a particular
bank for storing the data. If no bank is selected the by default Bank-0 is selected.
7. Interrupt control
• Basically, it is used for interrupt operation. It has got different interrupt pins such as
INT0, INT1 etc. through which we perform interrupt operation.
5. Program branching instruction: The instruction under this group are basically used for
conditional or unconditional jump operation or to call to a particular memory address or
to return to the particular memory address.
E.g. CALL, JMP etc.
1. RAM is
A) non-volatile
B) Interfacing
C) Volatile
D) None of these
Answer: C
2. ROM is
A) Volatile
B) interfacing
C) non-volatile
D) None of these
Answer: C
3. The Microcontroller is used for
A) Control oriented activity
B) program-oriented activity.
C) Transfer oriented activity.
D) None of these
Answer: A
4. How many pins are there in 8051 microcontrollers.
A) 124
B) 28
C) 30
D) 40
99 | P a g e
Answer: D
5. The internal clock frequency of 8051 microcontroller is
A) 10 MHz
B) 30
C) 10
D) 12
Answer: D
6. Out of 40 pins in 8051 microcontroller the no. Of pins used for port is
A) 16
B) 32
C) 24
D) none of these
Answer: B
7. In 8051 microcontroller the external clock frequency can be increased to
A)20 MHZ
B)12
C)10
D)none of these
Answer: A
8. Microprocessor is used for
A) program oriented
B) interfacing
C) control oriented
D) None of these
Answer: A
9. The function of latches
A) storing result
B) connecting ports
C) Data
D) Data and address
Answer: D
10. In 8051 microcontroller the timers are
A) Timer 0
B) Timer 1
C) Timer 0 and Timer 1
D) None of these
Answer: C
100 | P a g e
ASSIGNMENTFULL MARKS-100
SECTION-A
(ANSWER ALL QUESTIONS)
a) What are the different ports are in 8051 microcontroller and what is the function of the
ports in 8051 microcontroller?
b) Write the difference between the microprocessor and microcontroller.
c) What is the function of XTAL1 and XTAL2 in 8051 microcontroller.
d) How much RAM are used for the register bank selection option?
e) How many types of addressing modes are there in 8051 microcontroller?
f) Which control word bit is used for register bank selection?
g) What is the function of timer and it is of how many bits?
h) What is the function of TMO register?
SECTION-B
Time : 3 Hours
Q.CODE : HRB163
Answer Question No.1 (Part-1) which is compulsory, any EIGHT from Part-II and any TWO from Part-III.
Part-I
Part-II
Q2 Only Focused-Short Answer Type Questions- (Answer Any Eight out of Twelve) (6×8)
a) Explain the various steps of instruction decoding and execution in 8085.
b) Write the program to transfer the bytes of ROM space into RAM location starting at 50H.
c) Draw the timing diagram for execution of the instruction MVI A, 54H.
d) Write a subroutine to generate delay of 220ms. Assume crystal frequency = 12MHz.
e) How does data transfer from memory to microprocessor occurs? Explain in detail.
f) Describe all steps of interrupt process of 8085.
g) Do the schematic diagram to show the minimum interface between a computer and a peripheral.
h) What do you mean by stack and bank1 conflict with reference to their address in 8051? What steps are being
followed to overcome this problem?
i) Assume that we have 4 bytes of hexadecimal data: 35H, 42H, 3FH and 52H.
a. Find the checksum byte.
b. Perform the checksum operation to ensure data integrity.
c. If the second byte 42H has been changed to 22H, show how checksum detects the error.
102 | P a g e
j) Assume that the lower three bits of P1 are connected to three switches. Write a program to send the ASCII
characters 0,1,2,3,45,6,7 based on the status of the switches.
k) How direct memory data transfer occurs in 8085? Discuss using suitable figure.
l) Write a program to read 200 bytes of data from P1 and save the data in external RAM starting at RAM
location 3000H.
Part-III
Only Long Answer Type Questions (Answer Any Two out of Four)
Q3 Draw the block diagram of the 8259 and explain how it can be used for increasing the interrupt capabilities of 8085.
Explain how 8259 read the status and change the interrupt mode during a program execution.
(16)
Q4 Describe the internal hardware architecture of intel 8086 in details using suitable schematics.
(16)
Q5 Write an assembly language program to divide one 16bit number with an 8-bit number in 8085.
(16)
Q6 Draw and explain the architecture details of 8051 and discuss the different addressing modes of 8051.
(16)
SOLUTION
Q1
a) These signals are used to identify the nature of operation. There are 3 control signal and 3 status signals. Three
control signals are RD, WR & ALE and three status signals are IO/M, S0 & S1.
j)
7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 1
= 89H
Q2
103 | P a g e
a) The instructions which are to be executed by microprocessor are first stored in the memory
of the processor and then executed. But the processor does not execute the instructions
directly. It reads the instruction byte by byte and then executes it.
Consider MVI A, 18H. when the instruction is to be executed, the microprocessor gets the
Opcode for MVI A and performs the necessary operation on the data which is 18H in this case.
The Opcode for MVI A is 3EH. So the microprocessor first reads this Opcode from the
instruction and then performs the operation specified by Opcode over the data given.
Now let us assume we want to store the above instruction in a specific address say 5500H. We
know that in 8085 processor only one byte can be stored in each address location. Therefore
the Opcode 3EH is stored at the location 5500H and the data 18H is stored at the next
location 5501H.
Now for execution of this instruction the processor has to send the address to the memory for
reading. Then the MEMR’ signal is activated. As soon as this signal is activated the memory
places the Opcode byte (3EH) on the data bus.
The above process is considered as a single cycle and is called the OPCODE FETCH CYCLE. The
period during which the Opcode is fetched from address to the data bus is called as Opcode
fetch cycle.
A microprocessor by default knows that the first byte which is under execution is always
Opcode. The internal data bus sends the Opcode to the instruction decoder. The instruction
decoder decodes the Opcode and identifies it as MVI A instruction. As soon as this
information is obtained, the microprocessor searches for the data on which this operation
should be performed.
To find the data for performing the operation the microprocessor instructs the timing and
control unit to generate a proper timing signal to obtain the data. As a result of the timing
signal the program counter is increased by 1. So, the address bus moves from 5500H to
5501H. Now we know that the data 18H is placed at 5501H. So, when the address bus is
placed at 5501H, it identifies the data and the MEMR’ signal is activated. After the activation
of this signal the data is placed on the internal address bus and then it is moved to the
accumulator. Then the MVI A operation is performed on the data 18H and the result is sent to
the respective registers.
This process of placing the address and reading the data is considered as a single cycle and
this cycle is called Memory Read cycle. In general, these cycles are called as machine cycles.
b)
104 | P a g e
c)
f)
Q4
The total internal architecture of 8086 microprocessor can be basically divided into two different
units.
o Its function is to receive 6 no. of 8bit data at a time and stores the data in it and
then this data can be transferred to execution unit for performing arithmetic
and logical operation i.e. execution operation.
o The data is received from IO device to the 6 bytes instruction queue in FIFO
sequence.
Segment register
o So, when this address goes to the bus control and address generation, it gets
added of with the help of adder circuit which is present inside the bus control
and address generation.
o Hence the 20-bit segment address is added up with the 16-bit IP address with
the help of adder circuit and at the output we get a 20-bit effective memory
address or physical memory address.
o Effective memory address (EMA) or Physical memory address (PMA) = Segment
address*10H +Instruction pointer
o The block diagram of physical address generation is shown as follows.
• The execution unit receives the opcode of an instruction from the 6byte instruction
queue decodes it and perform the arithmetic and logical operation and stores the
result.
• The function of different units of execution units are
ALU
o It is basically used to perform the arithmetic and logical operation such as addition,
subtraction, multiplication, division, increment, decrement, comparison.
o After the arithmetic and logical operation, the result is check by the status flag.
108 | P a g e
Status Flag
o The status flags are basically used to check whether the result is writing or wrong.
o Accordingly, in 8086 microprocessor there are 9 active status flags out of which 6 are
conditional flag and 3 are control flag.
Conditional flag: Conditional flags are those where the output depends upon the
input. The conditional flags are Sign flag, zero flag, Auxiliary flag, Parity flag, Carry
flag and overflow flag.
➢ Sine flag: After the arithmetic operation if the result is negative then sign
flag is tends to logic 1 otherwise it will tend to logic 0.
➢ Zero flag: After the arithmetic operation if the result is zero then zero flag
will tend to logic 1 otherwise it will tend to logic 0.
➢ Auxiliary flag: After the arithmetic operation if there is a carry from 3rd to
4th bit then auxiliary carry will tends to logic 1 otherwise it will tend to logic
0.
➢ Parity flag: After the arithmetic operation if the result of the sum contains
even no. of 1’s then parity flag will tend to logic 1 otherwise it will tend to
logic 0.
➢ Carry flag : After the arithmetic operation if the result is more than 8 bit
then there will be a carry from 7-8 bit so carry flag will tends to logic 1 and
in case of 16 bit operation if there is a carry from 15 to 16 bit the carry flag
will tends to logic 1 otherwise it will tends to logic 0.
109 | P a g e
➢ Overflow flag: After the arithmetic operation if the result is more than 16
bits, in that case the data cannot be stored in accumulator or destination
register. So, in that case the overflow flag will tends to logic 1 otherwise it
will tend to logic 0.
Control flag: The control flags are basically used for control-oriented activity such
as to stop the program, set or reset the operation, status flag manipulation,
interrupt operation. So, in this case it is used for control-oriented activity and here
the output is does not depends upon input. The control flags are Directional flag,
Interrupt flag, Trap flag.
➢ Directional flag: In case of character or string operation in that case the
directional flag will tends logic 1 otherwise it will tend to logic 0.
➢ Interrupt flag and Trap flag: These two flags are basically used as
interrupt operation.
Resistors
o Since these registers are commonly used for storing the data temporarily for any
arithmetic and logical operation so these are known as general-purpose register.
111 | P a g e
Special purpose register: The special purpose registers are Stack pointer (SP),
Base pointer (BI), Source index register (SI), Destination index register (DI). These
are known as special purpose register because they are used for some specific
operation and these are 16-bit registers.
Q6
112 | P a g e
The total internal architecture of 8051 microcontroller basically consists of following units such
as
8. RAM
• It consists of 128 bytes of RAM out of which 32 bytes are used for register bank
selection.
113 | P a g e
• There are 4 register banks i.e. Bank-0, Bank-1, Bank-2, Bank-3 and these register banks
can be selected with the help of status control word i.e. RS 0 and RS1 which is present
inside the status flags 8051 microcontroller.
• So, with the help of logic bits we can select a particular register bank and the mode
of operation.
9. ROM
• it is basically used to store the predefine data or library function and its memory
capacity is 4kB.
10. CLK frequency / Oscillator
• Inbuilt crystal oscillator is present inside the microcontroller which provide internal
CLK frequency up-to 12MHz.
11. Ports
• There are 4 ports such as Port-0, Port-1, Port-2, Port-3 and each port can transfer and
receives 8-bit of data.
• It is a connecting point or interface between the processor and the external device.
12. Timer and counter
• There are 2 timers i.e. timer-0 and timer-1 which consists of 16 bits registers and is
basically used for time delay operation and providing a matching clock frequency.
13. Processor
• It is basically used for arithmetic ad logical operation and for storing the result, to the
processor status flag is attached which is basically used to check the status of the
output program or for checking the result.
• In 8051 microcontroller the status flag consists of 8-bits out of which 6 are define and
2 are undefined pins.
• The defined pins are Carry flag, Auxiliary carry, RS0, RS1, Overflow flag, Parity flag.
• RS0& RS1 are basically used for register bank selection or for selecting a particular
bank for storing the data. If no bank is selected the by default Bank-0 is selected.
• Basically, it is used for interrupt operation. It has got different interrupt pins such as
INT0, INT1 etc. through which we perform interrupt operation.
ADDRESSING MODE OF 8081 MICRCONTROLLER
It is the technique through which we are specifying data for operation or how the operand data
is specified accordingly in 8086 microprocessors. There are 8 different addressing mode
according to the type of operation it performs.