Interface
Internal structure
block diagram
Data Bus Buffer
It is three-state bi-directional 8-bit buffer
Used to interface the 82C55A to the system data
bus.
Data is transmitted or received by the buffer
upon execution of input or output instructions by
the CPU.
Control words and status information are also
transferred through the data bus buffer.
Functional description(cont’d)
Read/Write & control Logic
Read/Write and Control Logic
The function of this block is to manage all of
the internal and external transfers of both
Data and Control or Status words. It accepts
inputs from the CPU Address and Control
busses and in turn, issues commands to both
of the Control Groups.
Functional description(cont’d)
Read/Write Control Logic
(CS) Chip Select. A “low” on this input pin
enables the communication between the
82C55A and the CPU.
(RD) Read. A “low” on this input pin enables
82C55A to send the data or status
information to the CPU on the data bus. In
essence, it allows the CPU to “read from” the
82C55A.
Functional description(cont’d)
Read/Write Control Logic
Functional description(cont’d)
Read/Write Control Logic
(WR) Write. A “low” on this input pin enables the
CPU to write data or control words into the
82C55A.
(A0 and A1) Port Select 0 and Port Select 1.
These input signals, in conjunction with the RD
and WR inputs, control the selection of one of
the three ports or the control word register. They
are normally connected to the least significant
bits of the address bus (A0 and A1).
Functional description(cont’d)
Read/Write Control Logic
Functional description(cont’d)
Read/Write Control Logic
(RESET) Reset. A “high” on this input
initializes the control register to 9Bh and all
ports (A, B, C) are set to the input mode.
“Bus hold” devices internal to the 82C55A will
hold the I/O port inputs to a logic “1” state
with a maximum hold current of 400mA.
Functional description(cont’d)
Read/Write Control Logic
Group A and Group B Controls
The functional configuration of each port is
programmed by the systems software. In
essence, the CPU “outputs” a control word to
the 82C55A. The control word contains
information such as “mode”, “bit set”, “bit
reset”, etc., that initializes the functional
configuration of the 82C55A.
Functional description(cont’d)
Read/Write Control Logic
Each of the Control blocks (Group A and
Group B) accepts “commands” from the
Read/Write Control logic, receives “control
words” from the internal data bus and issues
the proper commands to its associated ports.
Control Group A - Port A and Port C upper
(C7 - C4)
Control Group B - Port B and Port C lower
(C3 - C0)
Functional description(cont’d)
Read/Write Control Logic
The control word register can be both written
and read as shown in the “Basic Operation”
table. Figure 4 shows the control word format
for both Read and Write operations. When
the control word is read, bit D7 will always be
a logic “1”, as this implies control word mode
information.
Functional description(cont’d)
Read/Write Control Logic
Ports
Ports A, B, and C
The 82C55A contains three 8-bit ports (A, B,
and C). All can be configured to a wide
variety of functional characteristics by the
system software but each has its own special
features or “personality” to further enhance
the power and flexibility of the 82C55A.
Ports(cont’d)
Port A
Port A One 8-bit data output latch/buffer and
one 8-bit data input latch. Both “pull-up” and
“pull-down” bus-hold devices are present on
Port A.
Ports(cont’d)
Port A
Ports(cont’d)
Port B & C
Port B One 8-bit data input/output latch/buffer
and one 8-bit data input buffer.
Port C One 8-bit data output latch/buffer and
one 8-bit data input buffer (no latch for input).
This port can be divided into two 4-bit ports
under the mode control. Each 4-bit port
contains a 4-bit latch and it can be used for
the control signal output and status signal
inputs in conjunction with ports A and B.
Ports(cont’d)
Port B & C
Ports(cont’d)
Operational description
Mode Selection
There are three basic modes of operation
than can be selected by the system software:
Mode 0 - Basic Input/output
Mode 1 - Strobed Input/output
Mode 2 - Bi-directional Bus
Ports(cont’d)
Operational description
When the reset input goes “high”, all ports
will be set to the input mode with all 24 port
lines held at a logic “one” level by internal
bus hold devices. After the reset is removed,
the 82C55A can remain in the input mode
with no additional initialization required. This
eliminates the need to pull-up or pull-down
resistors in all-CMOS designs.
8255A Mode 0 Operation
In Mode 0 operation, no handshaking will be used.
If both port A and port B are initialized as mode 0
operation, port C can be used together as an
additional 8-bit port, or two 4-bit ports.
When used as an outputs, port C line can be
set/reset by sending special control word to the
control register address.
The two halves of port C are independent and can
be set as input or output port independently.
8255A Mode 0 Operation
Mode 0(Basic Input timing diagram)
Mode 0(Basic output timing
diagram)
8255A Mode 1 Operation
In Mode 1 operation, single handshaking
(strobed) is used.
In this mode, some of the port C pins are
used for handshaking purpose.
If Port A set to mode 1 & input port: PC3, PC4,
and PC5 pins are used.
If Port A set to mode 1 & output port: PC3, PC6,
and PC7 pins are used.
If Port B set to mode 1 & input port: PC0, PC1,
and PC2 pins are used.
If Port B set to mode 1 & output port: PC0, PC1,
and PC2 pins are used.
8255A Mode 1 Operation
8255A Mode 2 Operation
Only port A can be initialized in mode 2.
In mode 2, port A can be used as bi-
directional handshake data transfer.
In this mode, PC3-PC7 are used for handshake
lines.
PC0-PC2 can be used as I/O pins if port B is set
to mode 0.
PC0-PC2 are used as handshake lines if port B
is set to mode 1.
Note that mode 2 does not mean that it uses
double handshake I/O.
Summary of Port C Usage when
Port A is in Mode 2
8255A Control Words
How to set 8255A? – by control words
Two control word formats are used:
mode-set control word format : to set the modes of each port
port C bit set/rest control word format : to set the particular bit in port
C.
These two formats are differentiated by the MSB of the
control word.
The control words can be sent to the corresponding 8255A’s
address by using I/O instruction.
z Addressing:
- port A: base address + 0
- port B: base address + 1
- port C: base address + 2
- control register: base address + 3
zExample
Base address: 06H
- port A: 06H + 0 = 06H
- port B: 06H + 1 = 07H
- port C: 06H + 2 = 08H
- control register: 06H + 3 = 09H
8255A – Mode Summary
10110001 00001100
8255A – Mode 1
Output on Port A
8255A – Mode 1
Output on Port B
Signal definitions for Mode 1
Strobed Input
82C55: Mode 1 Strobed Input
Signal Definitions for Mode 1
Strobed Output
82C55: Mode 1 Strobed Output
Signal Definition of Mode 1
Strobed Output
Whenever data are written to a port programmed as a strobed
output port, the OBF signal becomes a logic 0 to indicate that
data are present in the port latch (buffer) and is ready for
external device to access. The external device strobes the
ACK signal to indicate it has received the data. The ACK
returns the OBF to logic 1.
OBF: an output that goes low whenever data are output
(OUT) to the port A or port B latch.
ACK: an Acknowledge signal that causes OBF pin to return to
a logic 1. This signal is a response from external device to
indicate it has received data from 8255 port.
INTR a signal that often interrupts the processor when the
external device receives the data and sends back ACK the
signal.
INTE an internal bit programmed to enable or disable the
INTR pin. INTE A is programmed as PC6 (for output mode) or
PC4 (for input mode) and INTEB is PC2 (for both input/output
mode).
8255A – Mode 1
Timing diagram of output of mode 1
Example of Strobed Output
Mode of Operation for 8255A
cont…
;procedure that transfers
PORTC EQU 62H
PORTB EQU 61H the ASCII-coded
COMMAND EQU 63H ; control word character from AH to the
BIT1 EQU 2
PRINT PROC NEAR
printer via port B
;check for printer ready
IN AL,PORTC ;get OBF
TEST AL,BIT1 ;test OBF
JZ PRINT ;if OBF = 0
;send character to printer via port B
MOV AL,AH ;get character
OUT PORTB,AL ;send it
;send DS to printer
MOV AL,8 ;clear DS (data strobe pin on printer)
OUT COMMAND,AL ; 8=00001000B -> reset PC4
MOV AL,9 ;set DS
OUT COMMAND,AL ; 9=00001001B -> set PC4
RET
PRINT ENDP
8255A – Mode 1
Input on Port A
8255A – Mode 1
Input on Port B
8255A – Mode 1
Timing diagram of input of mode 1
Example Procedure of
keyboard encoder reading
;procedure that reads the keyboard encoder and
returns with the ASCII character in AL
=0020 BIT5 EQU 20H
=0022 PORTC EQU 22H
=0020 PORTA EQU 20H
0000 READ PROC NEAR
0000 E4 22 IN AL,PORTC ;read port C
0002 A8 20 TEST AL,BIT5 ;test IBF (PC5)
0004 74 FA JZ READ ;if IBF = 0
0006 E4 20 IN AL,PORTA ;read ASCII code
0008 C3 RET
0009 READ ENDP
8255A – Mode 2
0
1
1
0
0
1 1 1
1 0
1
1
0
1
1
1
0
1
1
Keyboard – program flow
8255 Interfacing case study: LCD
8255 interface case study: ADC
Interfacing with ADC&DAC;
Interfacing w/ Floppy Disk; w/
Machine Tool