Beruflich Dokumente
Kultur Dokumente
Term:2015-2016
III Year B.Tech I Sem
I/O Interface
UNIT 3 SYLLABUS
3.0 8086 interfacing
3.1 I/O interface with 8255-PPI
3.1.1 Various modes of operations and interfacing
to 8086,
3.2 Interfacing Keyboard,
3.3 LED Displays,
3.4 stepper motor interfacing and
3.5 A/D converter interface
3.5.1 D/A converter interface
3.6 Interfacing with advanced devices
3.6.1 Memory interfacing to 8086,
3.7 Interrupt structure of 8086,
Contd.
UNIVERSITYQUESTIONS
1.Show8255PPIinmode1operationandinterfaceto8086.
2.Explaintheinterruptstructureof8086.
3)ExplaintheneedforRS232Cinterface.Explainserialcommunication
standardswithrespecttovoltagelevels.
4.Interface8086tokeyboardanddisplayunit.
5.Explaininterruptserviceroutineconcept.
6.Explain8251USART..
7.ExplainA/DandD/Aconversionmechanism.
8.Explain8259interruptcontrolleralongwithcontrolregisters.
9.ExplaintheinterfacingofRS232to8086.
10.ExplainI/OmappedI/OandmemorymappedI/O.
11.a)Drawandexplaininterruptacknowledgementcycleof8086.
b)Explainthemodewordformatandthecommandwordformatof8251A
3.0
8086 Interfacing
Input port:
Output port:
the Microprocessors
experiments
lab
for
Interfacing
8255 Ports
8255 PPI has three 8-bit ports.
Port A (PA)
Port B (PB)
Port C (PC)
10
system bus.
The internal data bus and Outer pins D0-D7 pins
are connected in internally.
The direction of data buffer is decided by
Read/Control Logic.
PORT A:
PORT B:
This is a 8-bit buffer I/O latch.
It can be programmed by mode 0 and
mode 1.
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.
8255 Operations
The lines A1-A0 with RD, WR and CS form the
14
follows.
1. Outputs are latched.
2. Inputs are not latched.
3. Ports dont have handshake or interrupt capability.
16
Handshaking
Many I/O devices accept or release
17
Mode 1 - Input or
Output with Handshake
In this mode, handshake signals are exchanged between
2.
3.
4.
18
Example:
The computer send the data to the printer
20
~STB : The strobe input loads data into the port latch on a
0-to-1 transition.
IBF : Input buffer full is an output indicating that the input
latch contain information.
INTR : Interrupt request is an output that requests an
interrupts.
INTE : The interrupt enable signal is neither an input nor
an output; it is an internal bit programmed via the PC4
(port A) or PC2 (port B) bits.
PC7,PC6 : The port C pins 7 and 6 are general purpose
I/O pings that are available for any purpose.
21
23
25
2.
27
Key Debounce:
Whenever a mechanical push-bottom is pressed or
released once, the mechanical components of the
key do not change the position smoothly; rather it
generates a transient response. These may be
interpreted as the multiple pressures and responded
accordingly.
29
30
31
32
Flow Chart
33
35
a
f
b
c
Digit-abcdefg-hex
0-1111110-7E
1-0110000-30
2-1101101-6D
3-1111001-79
4-0110011-33
5-1011011-5B
6-1011111-5F
7-1110000-70
8-1111111-7F
9-1111011-7B
A-1110111-77
B-0011111-1F
C-1001110-4E
D-0111101-3D
E-1001111-4F
F-1000111-47
Contd
37
38
Contd
40
Contd
41
Contd
42
2 Types
I/O)
44
Interfacing
Isolated
I/O: uses the dedicated
Configurations
I/O instructions
(IN, OUT and INS, OUTS) and has its own address
space for I/O ports (0000H-FFFFH), isolated from
the memory address space.
45
a. Isolated I/O
Using dedicated I/O
instructions e.g. IN,
OUT 64 K I/O
Memory:
MOV
bytes
b. Memory-mapped I/O
Using ordinary memory
transfer instructions e.g.
MOV
I/O: IN
MOV
Range of memory addresses
assigned for I/O transfers
Memory
Content
Address
FFFF
Data
0000
Control signals
Include enable (chip select)
, read/write
Memory Banking
49
INTERFACING
WITH
The figure 1
shows a general
MEMORIES
block diagram of
an 8086 memory
array. In this,
the 16-bit word
memory is
partitioned into
high and low 8bit banks on the
upper halves of
the data bus
selected by BHE,
and AO.
50
3.7 Interrupt
Structure
of 8086
Definition:
The meaning of interrupts
is to break the
sequence of operation. While the CPU is executing a
program, on interrupt breaks the normal sequence of
execution of instructions, diverts its execution to some
other program called Interrupt Service Routine
(ISR).After executing ISR , the control is transferred back
again to the main program. Interrupt processing is an
alternative to polling.
Need for Interrupt: Interrupts are particularly useful
2.
3.
PRIORITY OF INTERRUPTS
INTERRUPT TYPE
PRIORITY
INT0,INT3-INT 255,INTO
HIGHEST
NMI(INT2)
INTR
SINGLE STEP
LOWEST
Type
Vector is a pointer (address) into Interrupt Vector Table,
IVT
IVT is stored in memory from 0000:0000 to 0000:03ffh
IVT Format
0000:0000
0000:0001
0000:0002
0000:0003
0000:0004
0000:0005
0000:0006
0000:0007
Offset
IP LSB
Interrupt 0
IP MSB
Segment
CS LSB
Offset
CS MSB
Interrupt 1
Segment
Given a Vector, where is the
ISR address stored in memory ?
Offset Type 4
0000:03fc
0000:03fd
0000:03fe
0000:03ff
Offset
Example:
Interrupt 255
Segment
int 36h
source
Clears the interrupt flag
Should save register contents that may be
Low-priority interrupts
These registers must be saved as a part of the ISR
and
STATUS registers
Reserved
INTs
BIOS
functions
(Basic
Input/
Output
System)
DOS
functions INT21
(Disk
Operating
System)
keyboard
display
printer
disk
date/time
memory management
program control
Specification: waits for the user to press a key on the keyboard and
returns the ASCII code.
Input: AH = 01 (function code)
Ex:
MOV ah, 01H; Request keyboard input
INT 21h
Controlling
the
Video
Display
DOS INT 21, function 02H: Display Output
Specification: writes a single character to the display screen, at the current
Ex: MOV AH, 02h;request character display
MOV DL, S
INTcharacter
21h
Input: AH = 02 (function code), DL = ASCII
to be sent to display.
cursor position.
Ex:
String DB Enter your name: $
MOV AH, 09h; request display
LEA DX, String; load address
INT 21h
63
64
65
66
67
68
69
Architecture
FEATURES:
8259 is Programmable Interrupt
Controller (PIC)
It is a tool for managing the interrupt
requests.
8259 is a very flexible peripheral controller chip:
PIC can deal with up to 64 interrupt inputs
interrupts can be masked individually.
various priority schemes can also programmed.
70
71
72
73
Working of 8259
1. One or more of the INTERRUPT REQUEST
Working of 8259
5. Then 8086 will send one more INTA pulse to
8259.
5.
INTA pulse.
75
76
8259 Command
There are 2 Command Words in 8259.
Words
1.Initialization
78
79
ICW3
Format
This word is read only when there is more than one 8259 in the
system and cascading is used, in which case SNGL = 0 in ICW1.
80
81
OCW1 Format
82
84
85
86
87
mode is programmed.
The interrupt requests are ordered in priority from 0
through 7 (0 highest).
When an interrupt is acknowledged the highest priority
is set.
This bit remains set until the microprocessor issues an
Rotating priority
mode
In some applications there are a number of interrupting devices
of equal priority.
In this mode, a device after being serviced, receives the lowest
priority.
So a device requesting an interrupt will have to wait, in the worst
89
Special mask
Some applications
may require an interrupt service routine
mode
Polled mode
In Polled mode the INT output functions as it
normally does.
The microprocessor should ignore this output.
This can be accomplished either by not connecting
Poll command.
The Poll command is issued by setting P = 1 in
OCW3.
91
92
bus.
control temporarily.
94
2.
3.
4.
5.
DMA controller
A DMA controller interfaces with several peripherals that
with
8086
is
the
96
8237 - DMA
Controller
97
Serial transfer
Sender
Receiver
S
E
N
D
E
R
R
E
C
E
I
V
E
R
Transmitter
Receiver
Transmitter
Receiver
Receiver
Transmitter
Transmitter
Receiver
Receiver
Transmitter
Half Duplex
Full Duplex
Stop Stop
Spac
e
Bit
Bit
0
Mark
d7
Goes out
last
Protocol
Start bit
Stop bit (s)
Chip can be programmed in 5, 6, 7, or 8 bit
characters
Start
1
bit
d0
Goes out
first
EXAMPLE
What is the total number of bits to be
Example
Calculate the time it takes to transfer the entire data in
prev. example using:
2400 bps
100,000 / 2400 = 41.67 sec
9600 bps
100,000 / 9600 = 10.4 sec
RS 232
RS 232
148
8
148
9
2
C
P
U
UART Chip
TTL output
148
3
9
Ground
Line
Linedriver
driver
Converting
Convertingvoltage
voltage
from
TTL
level
from TTL levelTo
To
RS232
level
RS232 level
Line
Linereceiver
receiver
Converting
Convertingvoltage
voltage
from
RS232
level
from RS232 levelTo
To
TTL
level
TTL level
148
8
Ground
Modem
Start bit
ASCII
Idle
Parity
1111010000011
11
A
Stop bit
RS232 standard
RS232
Undefined
+25
v
+3 v
-3 v
1
1 is represented by: -3 to -25
0 is represented by: +3 to +25
-25 v
-3 to +3 is undefined
Line driver Converting voltage from TTL level To RS232
level
of the capacitance
Increase as length increases
3.13.2 IEEE-488
The IEEE 488 (GPIB) Bus
Instrument
B
Instrument
C
Instrument
D
Talker/Listener
(DMM)
Listener
(Printer)
Talker
(Counter)
DI/O1
DI/O2
DI/O3
DI/O4
DI/O5
DI/O6
DI/O7
DI/O8
Data bus
IFC
ATN
SRQ
REN
EOI
DAV
NRFD
NDAC
Port
Interrupt
Aphysicalinterfaceonacomputerthroughwhichdataarepassedto
orfromaperipheral.
Acomputersignalorinstructionthatcausesthecurrentprocessto
betemporarilystoppedwhileaserviceroutineisrun.
Assemblylanguage
Tristate
AprogramminglanguagethatusesEnglishlikewordsandhasa
onetoonecorrespondencetomachinelanguage.
Atypeofoutputonlogiccircuitsthatexhibitsthreestates:HIGH,
LOW,andhighZ;usedtointerfacetheoutputsofasourcedeviceto
abus.
AGAIN:MOV AH,01
INT 16H
JZ NEXT
MOV AH,0
INT 16H
User's model
if system image does notDesign
make model clear and
Model
consistent, user will develop wrong conceptual model
User
Designer
System
System
image
it
and
construction
What is a prototype?
Why prototype?
Different kinds of prototyping
low fidelity
high fidelity
Compromises in prototyping
vertical
horizontal
Construction
What is a prototype?
In other design fields a prototype is a
small-scale model:
a miniature car
a miniature building or town
What is a prototype?
In interaction design it can be (among other things):
a series of screen sketches
a storyboard, i.e. a cartoon-like series of scenes
a Powerpoint slide show
a video simulating the use of a system
a lump of wood (e.g. iphone)
a cardboard mock-up
a piece of software with limited functionality
written in the target language or in another
language
Why prototype?
Evaluation and feedback are central to interaction
design
Stakeholders can see, hold, interact with a
prototype more easily than a document or a drawing
Team members can communicate effectively
You can test out ideas for yourself
It encourages reflection: very important aspect of
design
Prototypes answer questions, and support
designers in choosing between alternatives
What to prototype?
Technical issues
Work flow, task design
Screen layouts and information
display
Difficult, controversial, critical areas
Low-fidelity Prototyping
Uses a medium which is unlike the final
medium, e.g. paper, cardboard
Is quick, cheap and easily changed
Examples:
sketches of screens, task sequences,
etc
Post-it notes
storyboards
Wizard-of-Oz