Beruflich Dokumente
Kultur Dokumente
3003
OBJECTIVES:
Introduction to 8086 – Microprocessor architecture – Addressing modes - Instruction set and assembler directives –
Assembly language programming – Modular Programming - Linking and Relocation - Stacks - Procedures – Macros –
Interrupts and interrupt service routines – Byte and String Manipulation.
UNIT II 8086 SYSTEM BUS STRUCTURE (9)
8086 signals – Basic configurations – System bus timing –System design using 8086 – IO programming – Introduction to
Multiprogramming – System Bus Structure – Multiprocessor configurations – Coprocessor, Closely coupled and loosely
Coupled configurations – Introduction to advanced processors.
UNIT III I/O INTERFACING (9)
Memory Interfacing and I/O interfacing - Parallel communication interface – Serial communication interface – D/A and
A/D Interface - Timer – Keyboard /display controller – Interrupt controller – DMA controller – Programming and
applications Case studies: Traffic Light control, LED display , LCD display, Keyboard display interface and Alarm
Controller.
UNIT IV MICROCONTROLLER (9)
Architecture of 8051 – Special Function Registers(SFRs) - I/O Pins Ports and Circuits - Instruction set - Addressing
modes - Assembly language programming.
UNIT V INTERFACING MICROCONTROLLER (9)
Programming 8051 Timers - Serial Port Programming - Interrupts Programming – LCD & Keyboard Interfacing - ADC,
DAC & Sensor Interfacing - External Memory Interface- Stepper Motor and Waveform generation.
TOTAL: 45 PERIODS
OUTCOMES:
At the end of the course, the student should be able to:
Design and implement programs on 8086 microprocessor.
Design I/O circuits.
Design Memory Interfacing circuits.
Design and implement 8051 microcontroller based systems.
TEXT BOOKS:
1. Yu-Cheng Liu, Glenn A.Gibson, “Microcomputer Systems: The 8086 / 8088 Family -Architecture, Programming and
Design”, Second Edition, Prentice Hall of India, 2007.
2. Mohamed Ali Mazidi, Janice Gillispie Mazidi, Rolin McKinlay, “The 8051 Microcontroller and Embedded Systems:
Using Assembly and C”, Second Edition, Pearson Education, 2011
REFERENCE:
1. Doughlas V.Hall, “Microprocessors and Interfacing, Programming and Hardware:,TMH, 2012
UNIT-1 THE 8086 MICROPROCESSOR
Introduction to 8086 – Microprocessor architecture – Addressing modes - Instruction set and assembler directives
– Assembly language programming – Modular Programming - Linking and Relocation - Stacks - Procedures – Macros –
Interrupts and interrupt service routines – Byte and String Manipulation.
The BIU and EU function independently. The BIU interfaces the 8086 to the outside world. It fetches the
instructions, Reads data from memory and ports, and writes data to memory and I/O ports.
The EU receives the program instruction codes (OP-codes) and Data from the BIU, executes these
instructions and stores the results in general registers/memory or send them out as outputs through ports using
BIU. The EU has no connections to the system buses. It receives and outputs all its data through the BIU.
BIU contains
1. Segment Registers
2. Instruction Pointer
3. Instruction queue
EU contains
1. Arithmetic and Logic Unit ALU
2. General Purpose Registers
3. Index Registers
4. Pointers
5. Flag registers
1.3.2 BUS INTERFACE UNIT (BIU)
The function of BIU is to:
Fetch the instruction or data from memory.
Write the data to memory.
Write the data to the port.
Read data from the port.
1.3.3 INSTRUCTION QUEUE
The use of this queue is to hold next six instructions to be executed in FIFO manner.
To increase the execution speed, BIU fetches as many as six instruction bytes ahead to time from
memory.
All six bytes are then held in first in first out 6 byte register called instruction queue.
Then all bytes have to be given to EU one by one.
This pre fetching operation of BIU may be in parallel with execution operation of EU, which improves
the speed execution of the instruction.
1.3.4 EXECUTION UNIT (EU)
The functions of execution unit are:
To tell BIU where to fetch the instructions or data from.
To decode the instructions.
To execute the instructions.
The EU contains the control circuitry to perform various internal operations. A decoder in EU decodes the
instruction fetched memory to generate different internal or external control signals required to perform the
operation. EU has 16-bit ALU, which can perform arithmetic and logical operations on 8-bit as well as 16-bit.
1.3.5 GENERAL PURPOSE REGISTERS OF 8086
These registers can be used as 8-bit registers individually as AL-AH,BL-BH,CL-CH and DL-DH or can
be used as 16-bit in pair to have AX, BX, CX, and DX.
Note : Any Register RX can be 16 bit register, which can be used as 2 eight bit registers RL
and RH, where RL contains lower order byte of that 16 bit word and RH contains the higher order byte
of the word
AX Register: AX register is also known as accumulator register that stores operands for arithmetic operation
like divided, rotate. I/O operations and String Manipulation
BX Register: This register is mainly used as a base register. It holds the starting base location of a memory
region within a data segment. Contains a data pointer used for Based, Base indexed or Register indirect
addressing modes
CX Register: It is defined as a counter. It is primarily used in loop instruction to store loop counter. Mainly
used as counter in string manipulation and shift and rotate operations
DX Register: DX register is used to contain I/O port address for I/O instruction.
It can be used as a port number in I/O operations. In 32-bit integer multiplication and division Dx contains the
higher order word of initial or resulting 64 bit number.
1. Code Segment (CS): It is a 16-bit register containing the address of 64KB segment with processor
instructions. The CS register is used for addressing a memory location in the Code Segment of the memory,
where the executable program is stored. The processor uses CS register for all accesses to instructions
referenced by instruction pointer (IP register). The CS register cannot be changed directly. The CS register is
automatically updated during FAR JUMP, FAR CALL and FAR RET instructions.
2. Stack Segment (SS): It is a 16-bit register containing the address of 64KB segment with program
stack. SS defined the area of memory used for the stack. By default the processor assumes that all data are
referenced by stack Pointer SP and Base pointer BP, located in stack segment. It can be directly changed by
POP instruction
3. Data Segment (DS): It is a 16-bit register containing the address of 64KB segment program data. By
default the processor assumes that all data referenced by general registers (A,B,C,D) and Index registers,
located in data segment. The DS contains most data used by program. Data are accessed in the Data
Segment by an offset address or the content of other register that holds the offset address.DS can be changed
directly using POP and LDS instructions.
4. Extra Segment (ES): It is a 16-bit register containing the address of 64KB segment with program
data. .ES is additional data segment that is used by some of the string to hold the destination data. By default
the processor assumes that DI register references the ES segment in string manipulation instructions. ES
register can be changed directly using POP and LES instructions.
It is possible to change default segments used by general and index registers by prefixing instructions
with a CS,SS,DS and ES prefix
Six status flags and three conditional flags are available in flag register. Each flag is of 1 bit length. Based on
the binary value that it possess the status of MuP is assumed,
Conditional Flags
Conditional flags represent result of last arithmetic or logical instruction executed. Conditional flags
are as follows:
Overflow Flag (OF):
It occurs when signed numbers are added or subtracted. An OF indicates that the result has exceeded the
capacity of machine
Carry Flag (CF):
This flag indicates an overflow condition for unsigned integer arithmetic. It is also used in multiple-
precision arithmetic.
Auxiliary Flag (AF):
If an operation performed in ALU generates a carry/barrow from lower nibble (i.e. D0 – D3) to upper
nibble (i.e. D4 – D7), the AF flag is set i.e. carry given by D3 bit to D4 is AF flag. This is not a general-purpose
flag, it is used internally by the processor to perform Binary to BCD conversion.
Parity Flag (PF):
This flag is used to indicate the parity of result. If lower order 8-bits of the result contains even number
of 1’s, the Parity Flag is set and for odd number of 1’s, the Parity Flag is reset.
Zero Flag (ZF):
It is set; if the result of arithmetic or logical operation is zero else it is reset.
Sign Flag (SF):
In sign magnitude format the sign of number is indicated by MSB bit. If the result of operation is
negative, sign flag is set.
.
Control Flags
Control flags are set or reset deliberately to control the operations of the execution unit. Control flags
are as follows:
Trap Flag (TP):
It is used for single step control. It allows user to execute one instruction of a program at a time for
debugging. When trap flag is set, program can be run in single step mode.
Interrupt Flag (IF):
It is an interrupt enable/disable flag. If it is set, the maskable interrupt of 8086 is enabled and if it is
reset, the interrupt is disabled. It can be set by executing instruction sit and can be cleared by executing CLI
Instruction.
Direction Flag (DF):
It is used in string operation. If it is set, string bytes are accessed from higher memory address to lower
memory address. When it is reset, the string bytes are accessed from lower memory address to higher
memory address.
S/W Interrupts for 8086 are, INT instruction – breakpoint interrupt – type 3
--- INT <interrupt number> instruction selects any interrupts among 256 types
---INTO –Interrupt on overflow
---Single-step interrupt –generated if the TF flag is set. This is a type 1 interrupt.
When the CPU processes this interrupt it clears TF flag before calling the ISR.
A 40 pin DIP 8086 is shown above. 8086 can operate in two modes. They are,
Minimum mode – MN/MX ̅̅̅̅ pin (pin 33) is set (1) – Used in small systems with one CPU
Maximum mode -- MN/MX ̅̅̅̅ pin (pin 33) is Reset (0) – Used in large systems with more than one CPU
The following pin function descriptions are for the microprocessor 8086 in either minimum or maximum
mode.
AD0 - AD15 (I/O): Address Data Bus
These lines constitute the time multiplexed memory/IO address during the first clock cycle (T1) and
data during T2, T3 and T4 clock cycles. A0 is analogous to BHE for the lower byte of the data bus, pins D0-D7.
A0 bit is Low during T1 state when a byte is to be transferred on the lower portion of the bus in memory or I/O
operations. 8-bit oriented devices tied to the lower half would normally use A0 to condition chip select
functions. These lines are active high and float to tri-state during interrupt acknowledge and local bus "Hold
acknowledge".
A19/S6, A18/S5, A17/S4, A16/S3 (0): Address/Status
During T1 state these lines are the four most significant address lines for memory operations. During
I/O operations these lines are low. During memory and I/O operations, status information is available on these
lines during T2, T3, and T4 states.S5: The status of the interrupt enable flag bit is updated at the beginning of
each cycle. The status of the flag is indicated through this bus.
S6:
When Low, it indicates that 8086 is in control of the bus. During a "Hold acknowledge" clock period, the
8086 tri-states the S6 pin and thus allows another bus master to take control of the status bus.
S3 & S4:
Lines are decoded as follows:
A17/S4 A16/S3 Function
0 0 0 Interrupt acknowledge
0 1 1 Halt
1 1 0 Write memory
1 1 1 Passive State
0 0 No operation