mpmc u1 IT.pptx kg iron rubber Isuzu jee

athleticaashik 13 views 151 slides Aug 28, 2024
Slide 1
Slide 1 of 151
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134
Slide 135
135
Slide 136
136
Slide 137
137
Slide 138
138
Slide 139
139
Slide 140
140
Slide 141
141
Slide 142
142
Slide 143
143
Slide 144
144
Slide 145
145
Slide 146
146
Slide 147
147
Slide 148
148
Slide 149
149
Slide 150
150
Slide 151
151

About This Presentation

Diving ICICI se ICICI sej3 din hona fix dis dogi fix


Slide Content

UEC1402 MICROPROCESSOR & MICROCONTROLLER

OBE

PROGRAM OUTCOMES Engineering knowledge Problem Analysis Design and Development of Solutions Investigation of Complex problem Modern tool usage Engineer and Society Environment and Sustainability Ethics Individual and team work Communication Project management and Finance Lifelong Learning

4

5

6

7

8

9 Unit 1 to 3 Unit 4 & 5

THE 8086 MICROPROCESSOR UNIT 1 10

CONTENTS 11

Introduction to 8086 cannot be used stand alone since unlike a microcontroller it has no memory or peripherals 12

INTRODUCTION Microprocessor is a CPU on a single IC containing millions of very small components including transistors, resistors and diodes which work together. The microprocessor is a programmable device that takes in numbers, performs on them arithmetic or logical operations according to the program stored in memory and then produces other numbers as a result.

Little history 2 bit 2002 in early 1970s 4 bit 4004 in 1971 8 bit 8008 in 1972

CLASSIFICATION OF MICROPROCESSOR i )Based on size of the data: 4bit,8 bit,16 bit&32 bit. i i)Based on the application of the processor General Purpose Processor Microcontroller Special Purpose Processor

BLOCK DIAGRAM

ADVANTAGES Small size Low power consumption Reliable, versatile Low cost High speed of operation High processing capacity

Introduction 18

Overview of Microcomputer System 19

General Operation of a Computer 20

Microprocessors in Digital System Design 21

History of Microprocessors 22 Fair child semiconductors (founded in 1957) invented the first Integrated Circuit in 1959 that marked the microprocessor history. In 1968, Gordan Moore, Robert Noyce and Andrew Grove resigned from the Fair child semiconductors and started their own company: Integrated Electronics (Intel). In 1971, the first microprocessor Intel 4004 was invented.

23

24

25

Generation of Microprocessor 26

27

28

UNIT 1 – INTRODUCTION AND ARCHITECTURE OF MICROPROCESSORS Evolution of Microprocessors Von Neumann and Harvard Architectures 8086 Architecture Signal Description Addressing modes Instruction Set Assembler Directives Interrupts Procedure and Macro

MICROPORCESSOR - DEFINITION A multipurpose, Programmable electronic device that reads binary instruction from a storage device called memory, accepts binary data as input and processes the data according those instruction and provides results as output.

Block Diagram – S imple Microcomputer

Terms used in Microprocessor ALU – Arithmetic & Logical Unit Register array – temporary data storage Control Unit – Controls the flow of data on microprocessor, memory and peripherals Memory – used to store bulk of data and address Port – the physical device used to interface the computer buses to external system Bus – group of lines used to carry information (address bus, data bus, control bus)

Terms used in Microprocessor Programming system: Machine language Assembly language (Assembler converts the assembly language into machine language) High level language (Compiler converts the high level language into machine language) Bit – a single binary digit Nibble – 4 bits Byte – 8 bits Word – 16 bits Data – the quantity operated by an instruction of a program Address – an identification number in binary for memory locations

ADDRESS LABEL PROGRAM COMMENTS MOV CX, 0000H Initialize counter CX MOV AX,[1200] Get the first data in AX reg MOV BX, [1202] Get the second data in BX reg ADD AX,BX Add BX and AX JNC LOOP1 Check for carry INC CX If carry exists, increment the CX LOOP1 MOV [1206],CX Store the carry MOV [1204], AX Store the sum HLT Terminate the program

ADDRESS LABEL PROGRAM COMMENTS START MOV AX,[1200] Get the first data MOV BX, [1202] Get the second data MUL BX Multiply both MOV [1206],AX Store the lower order product MOV AX,DX Copy higher order product to DX MOV [1208],AX Store the higher order product STOP HLT Stop the program

8086 ARCHITECTURE

8086 - ARCHITECTURE Features: The Intel 8086 is a 16 bit Microprocessor It has 16 bit data bus It has 20 bit address bus The memory addressing capacity is 1 MB. Its clock frequency is 5 MHz.

8086 - ARCHITECTURE The 8086 processor is divided into two functional parts which works simultaneously : 1. Bus Interface Unit (BIU) 2. Execution Unit (EU)

8086 - ARCHITECTURE Bus Interface Unit – Interfaces the 8086 with the external world. Functions: Sends out addresses for memory locations and I/O ports. Reads/Writes data for memory and I/O Fetches Instructions from memory . When the EU is busy in instruction execution, the BIU continues fetching instructions from memory and stores them in the instruction queue. Blocks: Instruction Queue (6 byte instruction queue ) Segment Registers ( CS,DS,ES & SS) Instruction Pointer

BIU – segment registers

BUS INTERFACE UNIT

8086 - ARCHITECTURE Instruction Queue: It fetches six bytes of instructions ahead of time from memory. It follows the principle FIFO (First – in – First - out) It does pipelining (Fetching of next instruction while the current instruction is in execution) Segment Registers: 8086 can address 1 MB of memory. This 1 MB is divided into 16 segments each contains 64KB. Only 4 segments activated at a time. They are, Code segment Register – Code segment is the place where executable program is stored. CS register holds the upper 16 bits of the starting address of the code segment. Stack segment Register – A stack is a section of memory set aside to store addresses and data while sub program executes. SS register holds the upper 16 bits of the starting address of the stack segment.

8086 - ARCHITECTURE Data segment Register - DS register holds the upper 16 bits of the starting address of the data segment. Extra segment Register - ES register holds the upper 16 bits of the starting address of the extra segment . Instruction Pointer: IP register holds the next code byte within the code segment (offset address)

8086 - ARCHITECTURE 2. Execution Unit It does the execution of instructions. Tells BIU (addresses) where to fetch instructions or data Decodes & Executes instructions speeds up processing Blocks: General purpose registers Pointer and Index registers Flag register ALU, Decoder and control circuitry

EXECUTION UNIT

8086 - ARCHITECTURE General Purpose Registers: AX – 16 bit accumulator BX – a base register in address calculations to address the memory. CX – an implied counter by certain instructions DX – used to hold extra bits in multiplications and division

8086 - ARCHITECTURE Pointer and Index Registers which are used for various purposes such as addressing memory locations, manipulating data, and controlling the execution of instructions Stack Pointer (SP) – a 16 bit register pointing to program stack in stack segment Base Pointer (BP) – a 16 bit register pointing to data in stack segment. Source Index (SI) – used to hold the offset address of data segment Destination Index (DI) - used to hold the offset address of extra segment Index registers are particularly used for string manipulations

Pointer Registers - Stack Pointer (SP) - Purpose: Used to point to the top of the stack. - Function: Stores the offset within the stack segment (SS) which points to the current top of the stack. - Usage: In stack operations like push and pop, SP is updated to reflect the new top of the stack. Example: - SS = 1000H - SP = 0050H - Top of Stack = 10050H

Pointer Registers - Base Pointer (BP ) - Purpose: Used to access parameters passed via the stack. - Function: Stores the offset within the stack segment (SS) which points to the base of the stack frame. - Usage: Commonly used in subroutines to access function parameters and local variables. Example: - SS = 1000H - BP = 0040H - Base of Stack Frame = 10040H

Index Registers - Source Index (SI) - Purpose: Used as a source pointer in string operations . - Function: Stores the offset within the data segment (DS) or extra segment (ES) which points to the source data. - Usage: Used in instructions like MOVSB, MOVSW, CMPSB, and CMPSW to point to the source string. Example: - DS = 2000H - SI = 0030H - Source Address = 20030H

Index Registers - Destination Index (DI) - Purpose: Used as a destination pointer in string operations . - Function: Stores the offset within the extra segment (ES) or data segment (DS) which points to the destination data. - Usage: Used in instructions like MOVSB, MOVSW, STOSB, and STOSW to point to the destination string. Example: - ES = 3000H - DI = 0020H - Destination Address = 30020H

PHYSICAL ADDRESS CALCULATION

EXECUTION UNIT

Program status word (PWD) or Flag Register 54 Carry Parity Auxiliary Carry Zero Overflow Direction Interrupt enable Trap Sign 6 are status flags 3 are control flag

8086 – ARCHITECTURE Flag Register

PHYSICAL ADDRESS CALCULATION

INSTRUCTION SET Instruction: An instruction is a binary pattern designed inside a microprocessor to perform a specific function Opcode: it stands for operational code. It specifies the type of operation to be performed by CPU. Operand: Data on which operation should act. Operands may be register values or memory values. MOV AX,BX

INSTRUCTION SET - CLASSIFICATION Data transfer Instructions Arithmetic Instructions Logical Instructions Shift & Rotate Instructions String Instructions Machine/Processor Control Instructions Control transfer/Branching Instructions Flag manipulation Instructions I/O port Instructions Interrupt Instructions

1. DATA TRANSFER INSTRUCTIONS MOV – This instruction transfers data from one register/memory location to another register/memory location. Format : MOV reg1,reg2 MOV reg1,memory MOV memory,reg1 MOV reg /memory, immediate data Eg : MOV AX,BX MOV AX,[1200] MOV [1200],AX MOV AX,[SI] MOV AX,0001

1. DATA TRANSFER INSTRUCTIONS (ii) XCHG – This instruction exchanges the contents of the specified source and destination operands. Format: XCHG reg1,reg2 XCHG reg1,memory XCHG memory,reg1 Eg : XCHG AX,BX XCHG AX,[1200] XCHG [1200],AX

1. DATA TRANSFER INSTRUCTIONS (iii) PUSH – Pushes the contents of the specified register/memory locations on the stack. The stack pointer is decremented by 2 after each execution of the instruction. Format – PUSH reg /memory location Eg – PUSH AX (iv) POP – Pops out the top of the stack to the destination specified in the instruction. The stack pointer is incremented before execution of instruction Format – POP reg /memory Eg – POP AX

1. DATA TRANSFER INSTRUCTIONS (v) LEA – Load Effective Address Format – LEA BX,memory Eg – LEA BX,[1200] (vi) LDS/LES/LSS – Load data segment/extra segment/stack segment Format – LDS BX,memory Eg – LDS BX,[1200]

2. ARITHMETIC INSTRUCTIONS ADD – This instruction adds the source and destination operands and stores the result in destination. Format – ADD reg1,reg2 ( reg1=reg1+reg2) ADD reg1,memory Eg – ADD AX,BX ADD AX,[1200] (ii) ADC – Addition with carry Format – ADC reg1,reg2 (reg1 = reg1+reg2+CF) ADC reg1,memory Eg – ADC AX,BX ADC AX,[1200]

2. ARITHMETIC INSTRUCTIONS (iii) SUB – This instruction subtracts the source and destination operands and stores the result in destination. Format – SUB reg1,reg2 (reg1=reg1-reg2) SUB reg1,memory Eg – SUB AX,BX SUB AX,[1200] (iv) SBB – Subtraction with borrow Format – SBB reg1,reg2 (reg1 = reg1-reg2-CF) SBB reg1,memory Eg – SBB AX,BX SBB AX,[1200]

2. ARITHMETIC INSTRUCTIONS (v) MUL – unsigned multiplication Format – MUL reg ([DX][AX] = AX* reg ) Eg – MUL CL ([AX] = [CL]*[AL]) MUL CX([DX][AX] = [CX]*[AX]) (vi) IMUL – signed multiplication (vii) DIV – unsigned division Format – DIV reg ([DX][AX] = [DX][AX]/ reg ) Eg – DIV BL (quotient [AX] = [AL]/[BL]; Remainder [DX] = [AL]/[BL]) DIV BX ( quotient [AX] = [DX][AX]/[BX]; Remainder [DX] = [DX][AX]/[BX]) (viii) IDIV – signed division

2. ARITHMETIC INSTRUCTIONS (ix) INC – This instruction adds 1 to the content of a specified memory location or a register. Format – INC reg /memory ( reg =reg+1/memory = memory+1) Eg – INC AX (x) DEC – This instruction subtracts 1 to the content of a specified memory location or a register. Format – DEC reg /memory ( reg =reg-1/memory = memory-1) Eg – DEC AX

2. ARITHMETIC INSTRUCTIONS (xi) NEG – The negation instruction calculates the 2’s complement of a number. Format – NEG reg /memory Eg – NEG AL (xii) CMP – Comparison operation is performed by subtraction. But the results would not be stored rather the flags will get affected. Format – CMP reg1,reg2 (reg1-reg2) Eg – CMP AX,BX Condition CF ZF SF AX=BX 1 AX>BX AX<BX 1 1

2. ARITHMETIC INSTRUCTIONS (xiii) DAA – Decimal Adjust after addition Eg – ADD AL,CL DAA

2. ARITHMETIC INSTRUCTIONS (xiii) DAS – Decimal Adjust after subtraction Eg – SUB AL,CL DAS

2. ARITHMETIC INSTRUCTIONS (xix) CBW – Convert Byte to Word Input: AL=08 Output:AX =0008 Input: AL=88 OUTPUT:AX=FF88 (xx) CWD – Convert Word to Double word Input: Ax=1288 Output:DX = 0000;AX=1288 Input: AL=9988 Output:DX = FFFF;AX=9988

3. LOGICAL INSTRUCTIONS NOT – Logical NOT or 1’s complement of a number Format – NOT reg /memory( reg = ~ reg ) Eg – NOT AX (ii) AND – Logical AND between source and destination operands and stores the result in destination. Format – AND reg1,reg2 (reg1 = reg1 AND reg2) Eg – AND AX,BX

3. LOGICAL INSTRUCTIONS (iii) OR – Logical OR between source and destination operands and stores the result in destination. Format – OR reg1,reg2 (reg1 = reg1 OR reg2) Eg – OR AX,BX (iii) XOR – Logical XOR between source and destination operands and stores the result in destination. Format – XOR reg1,reg2 (reg1 = reg1 XOR reg2) Eg – XOR AX,BX

3. LOGICAL INSTRUCTIONS (v) TEST – Logical AND between source and destination operands. But the result would not stored rather the flags get affected Format – TEST reg1,reg2 (reg1 AND reg2) Eg – TEST AX,BX

4.SHIFT and ROTATE INSTRUCTIONS SHIFT – Shift operation can be logical left and right shift and arithmetic right and left shift. SAL/SHL – This instruction shifts each bit in the destination a specified number of bit positions to the left. As a bit is shifted out of the LSB position a zero is placed in LSB. The MSB is shifted into the carry flag. Format – SHL/SAL reg,1 SHL/SAL reg,CL Eg – SAL/SHL AX,1 SAL BL,CL

4.SHIFT and ROTATE INSTRUCTIONS (ii) SAR – Shift Arithmetic Right Format – SAR reg,1 SAR reg,CL Eg – SAR BX,1 SAR BX,CL

4.SHIFT and ROTATE INSTRUCTIONS (iii) SHR – Shift Logical Right Format – SHR reg,1 SHR reg,CL Eg – SHR BX,1 SHR BX,Cl

4.SHIFT and ROTATE INSTRUCTIONS Rotate – rotate the operand by the count specified. ( i ) ROR – Rotate Right Format – ROR reg,1 ROR reg,CL Eg – ROR BX,0001 ROR BX,CL

4.SHIFT and ROTATE INSTRUCTIONS Rotate – rotate the operand by the count specified. (ii) ROL – Rotate Left Format – ROL reg,1 ROL reg,CL Eg – ROL BX,0001 ROL BX,CL

4.SHIFT and ROTATE INSTRUCTIONS (iii) RCL – Rotate Left through Carry Format – RCL reg,1 RCL reg,CL Eg – RCL BX,0001 RCL BX,CL

4.SHIFT and ROTATE INSTRUCTIONS (iv) RCR – Rotate Right through Carry Format – RCR reg,1 RCR reg,CL Eg – RCR BX,0001 RCR BX,CL

5.STRING INSTRUCTIONS MOVSB – Move the string byte from DS:[SI] to ES:[DI] MOVSW – Move the string word from DS:[SI] to ES:[DI] LODSB - Load the string byte from DS:[SI] to AL LODSW - Load the string word from DS:[SI] to AX STOSB – Store the string byte in AL at ES:[DI] STOSW – Store the string word in AX at ES:[DI] CMPSB – Compare the string bytes at DS[SI] and at ES:[DI] CMPSW – Compare the string word at DS[SI] and at ES:[DI]

6. MACHINE/PROCESSOR CONTROL INSTRUCTIONS STC – Set Carry flag CLC – Clear carry flag CMC – Complement Carry flag STD – Set Direction flag CLD – Clear Direction flag STI – Set Interrupt flag CLI – Clear Interrupt flag HLT – Stops the execution NOP – No operation ESC – CPU differentiates 8087 instruction with the ESC instruction. When ESC instruction is decoded bus control is given to 8087 and then CPU deactivates TEST pin and does the process. LOCK – Lock the bus during next instruction WAIT - The processor enters into wait state after execution of the WAIT instruction until TEST pin is low.

7. I/O INSTRUCTIONS IN – It copies a data from the input port to the AL or AX register. Format – IN AL/AX, 8/16 bit port no Eg – IN AL,80 (ii) OUT – It transfers a byte from AL or a word from AX to the port specified in the instruction. Format – OUT 8/16 bit port no,AL /AX Eg – OUT 80,AL

8. FLAG MANIPULATIONINSTRUCTIONS LAHF – This instruction loads the AH register with the lower order byte of the flag register SAHF – This instruction stores the contents of AH register into the lower order byte of the flag register PUSHF – This instruction first decrements the stack pointer by 2. Then the contents of the 16 bit flag register is pushed into the stack addressed by SP. POPF – This instruction moves the contents of the first to locations in stack into flag register and then SP is incremented by 2.

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Unconditional Branching: ( i ) JMP – JMP instruction causes the 8086 to fetch its next instruction from the location specified in the instruction rather than from the next location after JMP instruction. Types: Near/ Intrasegment jump Far/Intersegment jump Format – JMP address Eg – JMP 4000 JMP [SI]

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Unconditional Branching: (ii) CALL – CALL instruction is used to transfer execution to a subroutine or a procedure Types: Near/ Intrasegment CALL Far/Intersegment CALL Format – CALL address Eg – CALL 4000 Operation (Near CALL)– SP=SP-2 IP loaded into stack IP= IP+address CS remains unchanged

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Unconditional Branching: (ii) CALL – CALL instruction is used to transfer execution to a subroutine or a procedure Types: Near/ Intrasegment CALL Far/Intersegment CALL Format – CALL address Eg – CALL 4000 Operation – SP=SP-2 IP loaded into stack IP= IP+address CS remains unchanged

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Eg – CALL 4000 Operation (FAR CALL)– SP=SP-2 CS loaded into stack SP=SP-2 IP loaded into stack IP= IP+address CS remains unchanged

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Unconditional Branching: (iii) RET – Return instruction will return the execution from a procedure to the next instruction after the CALL instruction in the calling program. Operation – For intrasegment return, IP is loaded from stack SP=SP+2 For intersegment return, IP is loaded from stack SP=SP+2 CS is loaded from stack SP=SP+2

9. CONTROL TRANSFER/BRANCHING INSTRUCTIONS Conditional Jump – It causes the 8086 to branch to a new memory location specified in the instruction if the condition it true. Eg – JC JNC JZ JNZ JE JNE

10. INTERRUPT INSTRUCTIONS Instructions that initiate an interrupt sequence ( i ) INT n – Software interrupt instruction with interrupt type ‘n’ Operation: SP=SP-2 PSW loaded into stack Interrupt flag and Trap flag reset SP=SP-2 CS loaded into stack CS = new address SP=SP-2 IP loaded into stack IP= new offset address

10. INTERRUPT INSTRUCTIONS (ii) IRET – Interrupt Return Operation: IP is loaded from stack SP=SP+2 CS is loaded from stack SP=SP+2 PSW is loaded from stack SP=SP+2

ADDRESSING MODE The way in which an operand is specified is called addressing mode ( i ) Immediate addressing mode – Eg : MOV AX,0001 (ii) Register addressing mode – Eg : MOV AX,BX (iii) Direct addressing mode – Eg : MOV AX,[1200] (iv) Register indirect addressing mode – Eg : MOV AX,[SI] (v) Register relative addressing mode – Eg : MOV AX,[BX+7] (vi) Based indexed addressing mode – Eg : MOV AX,[BX+SI] (vii) Relative Based indexed addressing mode - Eg : MOV AX,[BX+SI+7] (viii) Intrasegment direct addressing mode – Eg : JMP 2000 (ix) Intrasegment indirect addressing mode – Eg : JMP [BX] (x) Intrasegment direct addressing mode – Eg : JMP 2000 (xi) Intrasegment indirect addressing mode – Eg : JMP [BX] (xii) String addressing mode – Eg:MOVSB , MOVSW (xiii) I/O addressing mode – Eg : IN AL,08 (xiv) Implied addressing mode – Eg : STC, HLT, STI

ASSEMBLER DIRECTIVES An assembler is a program that translates an assembly language program into equivalent machine language program. Assembler directives help the assembler to correctly generate the machine code for the assembly language program. They just give directions to the assembler but are not translated into machine language.

ASSEMBLER DIRECTIVES DB : Define Byte Format: Name of the variable DB values Eg : START DB 08 (ii) DW: Define Word Format: Name of the variable DW values Eg : START DB 0808 (iii) DD: Define Double Word Format: Name of the variable DD values Eg : START DB ABCD 0808

ASSEMBLER DIRECTIVES (iv) DB : Define Quad word(8 bytes) Format: Name of the variable DQ values Eg : START DB ABCD 1234 0808 2345 (v) DT: Define Ten bytes Format: Name of the variable DT values Eg : START DB 0808 1244 1234 1234 12AB (vi) DD: Define Double Word Format: Name of the variable DD values Eg : START DB ABCD0808

ASSEMBLER DIRECTIVES (vii) EQU : Equivalent Format: Name EQU value Eg : X EQU 03 (viii) ASSUME : Assume the name of the logical segment to different segments. Format: ASSUME segment register: name Eg : ASSUME CS:CODE 1, DS:DATA1 (ix) GROUP: To form a logical group of the segments with a similar purpose. Format: NAME GROUP segment, segment… Eg : PROGRAM GROUP Code1, Code2,…

ASSEMBLER DIRECTIVES (x) ORG : Origin Format: ORG address Eg : ORG 3000 (xi) END : End of the program Format: END (xii) PROC: Procedure Format: Label PROC NEAR/FAR Eg : PROGRAM PROC NEAR

ASSEMBLER DIRECTIVES (xiii) ENDP : END of the procedure Format: Label ENDP Eg : PROGRAM PROC NEAR . . PROGRAM ENDP

ASSEMBLER DIRECTIVES ( xiv) MACRO: Macro Format: Label MACRO Eg : CODE MACRO ( xv) ENDM: End of Macro Format : ENDM Eg : CODE MACRO . . . ENDM

Procedure Whenever a group of instructions needed to be used several times throughout the program, to avoid writing the sequence of instructions in the program each time, the sequence can be written as a separate sub program called Procedure . Multiple calls Nested Procedure Recursive Procedure

PROCEDURE - DEFINITION COST PROC NEAR/FAR . . . COST ENDP

MACRO Macro is a segment of code that needs to be written only once. The macro assembler generates the code in the program each time where the macro is “called ” EXAMPLE: CODE MACRO . . . ENDM

INTERRUPT INTERRUPT – The process of interrupting the normal execution of the program to carry out the specific task Interrupt Service Routine (ISR) – The program associated with interrupt A Processor can be interrupted By an External signal generated by a peripheral B y an internal sign generated by a special instruction in the program

Processing of an Interrupt

CLASSIFICATION OF INTERRUPTS Software & Hardware Interrupts Vectored & Non vectored Interrupts Maskable & Non Maskable Interrupts

Hardware & Software Interrupts Hardware Interrupt – The interrupts initiated by external hardware by sending an appropriate signal to the interrupt pin of the processor Software Interrupt – The interrupts generated by special instructions. They are used to implement system service/calls

Vectored & Non vectored Interrupts Vectored Interrupt - If a program control automatically branches to a specific address when an interrupt signal is accepted by the processor Non vectored Interrupt – the device should supply the address of the ISR to be executed in response to the interrupt.

Maskable & Non Maskable Interrupt Maskable Interrupt – the interrupt can be disabled or rejected. Non Maskable Interrupt – the interrupt which cannot be disabled or rejected.

Interrupt Vector Table (IVT)

8086 PINS & SIGNALS

PINS AND SIGNALS 8086 operates in two modes. ( i ) Minimum mode ( single processor) (ii) Maximum mode ( Multiprocessor) The signals are grouped into three categories. Signals common to both the modes. Signals for Minimum mode alone. Signals for Maximum mode alone.

COMMON SIGNALS 113 AD -AD 15 (Bidirectional) Address/Data bus Low order address bus; these are multiplexed with data. When AD lines are used to transmit memory address the symbol A is used instead of AD, for example A -A 15 . When data are transmitted over AD lines the symbol D is used in place of AD, for example D -D 7 , D 8 -D 15 or D -D 15 . A 16 /S 3 , A 17 /S 4 , A 18 /S 5 , A 19 /S 6 High order address bus. These are multiplexed with status signals

COMMON SIGNALS 114 BHE (Active Low)/S 7 (Output) Bus High Enable/Status It is used to enable data onto the most significant half of data bus, D 8 -D 15 . if it is ‘1’ data is transferred on D -D 07 . 8-bit device connected to upper half of the data bus use BHE (Active Low) signal. It is multiplexed with status signal S 7 . MN/ MX MINIMUM / MAXIMUM This pin signal indicates what mode the processor is to operate in. RD (Read) (Active Low) The signal is used for read operation. It is an output signal. It is active when low.

COMMON SIGNAL S 115 TEST input is tested by the ‘WAIT’ instruction. 8086 will enter a wait state after execution of the WAIT instruction and will resume execution only when the is made low by an active hardware. This is used to synchronize an external activity to the processor internal operation.   READY This is the acknowledgement from the slow device or memory that they have completed the data transfer. The signal made available by the devices is synchronized by the 8284A clock generator to provide ready input to the 8086. The signal is active high.

COMMON SIGNALS 116 RESET (Input) Causes the processor to immediately terminate its present activity. The signal must be active HIGH for at least four clock cycles. CLK The clock input provides the basic timing for processor operation and bus control activity. Its an asymmetric square wave with 33% duty cycle. INTR Interrupt Request This is a triggered input. This is sampled during the last clock cycles of each instruction to determine the availability of the request. If any interrupt request is pending, the processor enters the interrupt acknowledge cycle. This signal is active high and internally synchronized.

MINIMUM/MAXIMUM MODE SIGNALS 117 The 8086 microprocessor can work in two modes of operations : Minimum mode and Maximum mode . In the minimum mode of operation the microprocessor do not associate with any co-processors and can not be used for multiprocessor systems. In the maximum mode the 8086 can work in multi-processor or co-processor configuration. Minimum or maximum mode operations are decided by the pin MN/ MX(Active low). When this pin is high 8086 operates in minimum mode otherwise it operates in Maximum mode.

MINIMUM MODE SIGNALS Pins 24 -31 For minimum mode operation, the MN/ is tied to VCC (logic high) 8086 itself generates all the bus control signals   DT/ ( Data Transmit/ Receive ) Output signal from the processor to control the direction of data flow through the data transceivers ( Data Transmit/ Receive ) Output signal from the processor to control the direction of data flow through the data transceivers ( Data Enable ) Output signal from the processor used as out put enable for the transceivers ( Data Enable ) Output signal from the processor used as out put enable for the transceivers ALE ( Address Latch Enable ) Used to demultiplex the address and data lines using external latches M/ Used to differentiate memory access and I/O access. For memory reference instructions, it is high . For IN and OUT instructions, it is low . Used to differentiate memory access and I/O access. For memory reference instructions, it is high . For IN and OUT instructions, it is low . Write control signal; asserted low Whenever processor writes data to memory or I/O port Write control signal; asserted low Whenever processor writes data to memory or I/O port ( Interrupt Acknowledge ) When the interrupt request is accepted by the processor, the output is low on this line. ( Interrupt Acknowledge ) When the interrupt request is accepted by the processor, the output is low on this line. 118

MINIMUM MODE SIGNALS HOLD Input signal to the processor form the bus masters as a request to grant the control of the bus. Usually used by the DMA controller to get the control of the bus. HLDA ( Hold Acknowledge ) Acknowledge signal by the processor to the bus master requesting the control of the bus through HOLD. The acknowledge is asserted high, when the processor accepts HOLD. 119 Pins 24 -31 For minimum mode operation, the MN/ is tied to VCC (logic high) 8086 itself generates all the bus control signals  

MAXIMUM MODE SIGNALS During maximum mode operation, the MN/ is grounded (logic low) Pins 24 -31 are reassigned   , , Status signals ; used by the 8086 bus controller to generate bus timing and control signals. These are decoded as shown. Status signals ; used by the 8086 bus controller to generate bus timing and control signals. These are decoded as shown. 120

MAXIMUM MODE SIGNALS During maximum mode operation, the MN/ is grounded (logic low) Pins 24 -31 are reassigned   , ( Queue Status ) The processor provides the status of queue in these lines. The queue status can be used by external device to track the internal status of the queue in 8086. The output on QS and QS 1 can be interpreted as shown in the table. ( Queue Status ) The processor provides the status of queue in these lines. The queue status can be used by external device to track the internal status of the queue in 8086. The output on QS and QS 1 can be interpreted as shown in the table. 121

MAXIMUM MODE SIGNALS During maximum mode operation, the MN/ is grounded (logic low) Pins 24 -31 are reassigned   , ( Bus Request/ Bus Grant ) These requests are used by other local bus masters to force the processor to release the local bus at the end of the processor’s current bus cycle. These pins are bidirectional. The request on will have higher priority than 122 An output signal activated by the LOCK prefix instruction. Remains active until the completion of the instruction prefixed by LOCK. The 8086 output low on the pin while executing an instruction prefixed by LOCK to prevent other bus masters from gaining control of the system bus.

Von Neumann and Harvard Architectures VON NEUMANN ARCHITECTURE HARVARD ARCHITECTURE It is ancient computer architecture based on stored program computer concept. It is modern computer architecture based on Harvard Mark I relay based model. Same physical memory address is used for instructions and data. Separate physical memory address is used for instructions and data. There is common bus for data and instruction transfer. Separate buses are used for transferring data and instruction. Two clock cycles are required to execute single instruction. An instruction is executed in a single cycle. It is cheaper in cost. It is costly than Von Neumann Architecture. CPU can not access instructions and read/write at the same time. CPU can access instructions and read/write at the same time. It is used in personal computers and small computers. It is used in micro controllers and signal processing.

Von Neumann and Harvard Architectures

UNIT 2 8086 BUS ARCHITECTURE AND INTERFACING Modes of operation Memory Interfacing and I/O Interfacing Parallel Communication Interface Serial Communication Interface Timer Keyboard and Display Controller DMA Controller Introduction to Mobile Processors

Modes of Operation MINIMUM MODE MN/MX is connected to +5V. S ingle Processor all control signals are given out by Microprocessor itself MAXIMUM MODE MN/MX is connected to Gnd Multiprocessor The chip called Bus controller derives the control signals

MINIMUM MODE CONFIGURATION

MAXIMUM MODE CONFIGURATION

8255 – PROGRAMMABLE PERIPHERAL INTERFACE FEATURES: ( i ) it has 24 I/O pins that are grouped into three 8 bit ports namely A,B,C. (ii) the eight bit ports of port C can be used as individual bits :(C upper) and (C lower). (iii) modes of operation : I/O mode & BSR mode. (iv) the BSR mode is used to set or reset the bits in port C individually. (v) GA – port A & port Cu. GB – port B & port Cl

BLOCK DIAGRAM - 8255

MODES OF OPERATION

BSR MODE

I/O MODE CONTROL WORD FORMAT

8251 – SERIAL COMMUNICATION INTERFACE USART – Universal Synchronous Asynchronous Receiver Transmitter It supports both synchronous and asynchronous communication. It allows full duplex communication. It has built in baud rate generator

CONTROL WORDS MODE WORD

COMMAND WORD

STATUS WORD

8237 – DMA CONTROLLER It has 4 independent channels each of which capable of transferring 64KB. Memory address can be incremented or decremented. It can be cascaded to expand any number of DMA channels.

DMA – Block Diagram Data Bus Buffer Timing and Control Unit DMA Channels Priority Block Internal Registers Memory Address Register Count Register Base address and Base count register Command register Mode Register Request Register Mask Register Status Register

Command Register

Mode Register

Request Register

Mask register

Status Register

8253/54 TIMER/COUNTER Generates accurate time delay. Timer or counter operation Counting in binary or BCD.

Control Word Register

MODES Mode 0 – Interrupt on terminal count Mode 1 - Programmable one shot Mode 2 – Rate generator Mode 3 – square wave generator Mode 4 - Software Triggered Strobe. Mode 5 - Hardware Triggered Strobe.