Lecture 5 - Basic IO
Lecture 5 - Basic IO
I/O
Special purpose I/O interfaces
UCCE2043 Basic Microprocessor display
parallel printer interface
Basic Input/Output serial communication interface
local area network interface
Not all microcomputer systems employ
H Y Lee
each of these types
[email protected] Special purpose interfaces are
implemented as add-on cards on the PC
Ex: PCI-USB Card, PCI-eSATA Card, etc…
1 2
Memory-mapped I/O
A memory-mapped I/O device is treated as a memory
location in the memory map.
No separate I/O interface, separate I/O instructions, separate
I/O control signals such as IORC and IOWC is required.
Advantage:
Personal computer
Any memory transfer instruction can be used to access the
I/O device.
I/O Map
Disadvantage:
A portion of the memory system is used as the I/O map.
7 8
Input Output
Bus Bus
cycle Cycle
Of Of
8088 8088
9 10
11 12
Answer (b)-8086 Answer (b)-8086
T1: Address 0338h is put on pins AD0-AD15 plus
BHE=low is latched by the 74LS373 when ALE is
activated
T2: 1233h, the contents of AX, is put on AD0-AD15
(33h on AD0-AD7, 12h on AD8-AD15) and IOWC’ is
activated
T3: Setup time
During this interval, with the help of the signals A0=0 and
BHE=0, the low and high bytes are written to the appropriate
ports.
It must be noted that since the operand is a 16 bit word and the
port address is an even address, the 8086 CPU does not
generate address 0339h
Port address 338h is connected to the D0-D7 data bus and port
address 339h is connected to the D8- D15 data bus.
T4: Byte is written to the port assuming zero wait states
13 14
I/O E.g.
interfaces
– Latch
SEL
5 to
20ms
23 24
DC Characteristics of 8088 Output devices
Interfacing an output device requires matching the voltage and
current relationships of the devices and processor.
From the datasheet, output levels of TTL compatible devices
are 0.0 to 0.4V for logic 0 and 2.4V to 5.0V for logic 1.
The current levels are 0.0 to 2.0mA (logic 0) and 0.0 to -400uA
(logic 1).
27 28
PPI (8255A) PPI (8255A)
PA0 - PA7: input or output
PB0 - PB7: input or output
PC0 - PC7: This 8 bit port can be all input or output.
It can also be split into two parts,CU (PC4 - PC7)
and CL (PC0 - PC3). 8
Data
Port A
8
A0
IN or OUT 8 bits at a time
IN or OUT 8 bits at a time
IN or OUT 8 bits at a time or 4 with 4 combination
Write only! OUT 8 bits at a time
29 30
31 32
Mode 0 (Basic Input and output) Interfacing 8255 with LEDs
33 34
MOV DX,0FF13H
MOV AL,89H
Some programming hints for PPI connection program OUT DX,AL
MOV DX,0FF10H
(Step 1) Initialize 8255A: BEGIN:
MOV_L:
MOV
OUT
AL,01H
DX,AL
Command word needs to be written to command register CALL
ROL
DELAY
AL,1
MOV AL, ????? (which command word is to be written) TEST
JZ
AL,80H
MOV_L
OUT ?????, AL (which port should we output)
MOV AL,80H
MOV_R: OUT DX,AL
(Step 2) Initialize the output: CALL DELAY
ROR AL,1
All data in the output need to be cleared (start counting TEST AL,01H
JZ MOV_R
from 0) JMP BEGIN
Try to modified the above instructions DELAY PROC NEAR
MOV CX,4FFFH
LOOP $
RET
DELAY ENDP
CODE ENDS
END
35 36
8-7segment display through 8255 Common anode
a-1 b-10 c-8 d-6 e-5 f-2 g-9
0 0 0 0 0 0 0 1 40
74LS244? 1 1 0 0 1 1 1 1 79
2 0 0 1 0 0 1 0 24
3 0 0 0 0 1 1 0 30
4 1 0 0 1 1 0 0 19
5 0 1 0 0 1 0 0 12
6 0 1 0 0 0 0 0 02
7 0 0 0 1 1 1 1 78
8 0 0 0 0 0 0 0 00
9 0 0 0 1 1 0 0
A 0 0 0 1 0 0 0
b 1 1 0 0 0 0 0
C 0 1 1 0 0 0 1
d 1 0 0 0 0 1 0
WHY 37ohm, 2.2kohm, 1Kohm?
E 0 1 1 0 0 0 0
F 0 1 1 1 0 0 0
Manufacture
recommendation-
the LED display
flash between
100 HZ and 4511 –BCD to 7-segment latch/decoder/driver
1500Hz, 1ms = What is the cost?
125Hz
BGC-8088 -
8088 and Clock
Program PC4 of the 8255 to Control Circuits
generate a pulse of 50ms Section
with 50% duty cycle.
MOV DX,83H
MOV AL,9H
OUT DX,AL
CALL DELAY
MOV AL,8H
OUT DX,AL
CALL DELAY
43 44
BGC-8088 - Memory & I/O
Device Address Decoder
BGC-8088 -
8255 (PPI), 8259 (PIC) and
8254 (Timer) Sections
FF10-FF1F
45 46
BGC-8088 –
Programmable
Keyboard/Display Interface
47 UPDATE 2009 48