Unit-3 IO Interfacing
Unit-3 IO Interfacing
1
I/O Interface
INTRO TO I/O INTERFACE
• I/O instructions are IN, INS, OUT, and OUTS
PORT C:
• This is a 8-bit Unlatched buffer Input and an
Output latch.
• It is spitted into two parts.
• It can be programmed by bit set/reset operation.
Pin Diagram
Pin Description
• PA7-PA0 : These are eight port A lines that acts as either
latched output or buffered input lines
depending upon the control word loaded into the
control word register.
• PB0-PB7 : These are the eight port B lines which are used
as latched output lines or buffered input lines in the
same way as port A.
Pin Description(Contd…)
• RD : This is the input line driven by the
microprocessor and should be low to indicate read
operation to 8255.
• A1-A0 : These are the address input lines and are driven
by the microprocessor.
INTERRUPTS
MASKABLE NON-MASKABLE
INTR
SINGLE STEP
LOWEST
Interrupt Vector Table – IVT (in memory)
• x86 has 256 interrupts, specified by Type Number or Vector
• 1 byte of data must accompany each interrupt; specifies Type
Vector is a pointer (address) into Interrupt Vector Table, IVT
– IVT is stored in memory from 0000:0000 to 0000:03ffh
0000:0003
Segment IP MSB
0000:0004 CS LSB
0000:0005
Offset CS MSB
Interrupt 1
0000:0006
0000:0007
Segment
Offset Type 4
0000:03fc
0000:03fd
Offset Example: int 36h
0000:03fe
Interrupt 255
Segment Offset = (544) = 216
0000:03ff
= 00d8h
Structure of Interrupt Vector Table 8086/88
Interrupt Service Routine (ISR)
• Similar to a subroutine
• Attends to the request of an interrupting source
– Clears the interrupt flag
– Should save register contents that may be affected by
the code in the ISR
– Must be terminated with the instruction RETFIE
• When an interrupt occurs, the MPU:
– Completes the instruction being executed
– Disables global interrupt enable
– Places the return address on the stack
Interrupt Service Routine (ISR)
• High-priority interrupts
– The contents of W, STATUS, and BSR registers are
automatically saved into respective shadow registers.
• Low-priority interrupts
– These registers must be saved as a part of the ISR
• If they are affected