Professional Documents
Culture Documents
Features:
Designed by Intel to interface with 8,16 bit & higher
capability microprocessor with I/O peripherals
It has 24 I/O lines which may be programmed in to two
groups of 12 lines or three groups of 8 lines
The two group I/O pins named as GROUP A and GROUP
B
Each group contains a two sub group of 8 bit I/O lines & 4
bit I/O lines
Group A contains an 8 bit port A along with a 4 bit port C
called Cupper
Group B contains an 8 bit port B along with a bit port C
called C
8255 Pin diagram
PA7-PA0 buffered/latched i/o 8 bit PORT A
PB7-PB0 buffered/latched i/o 8 bit PORT B
PC7-PC4 Upper nibble of PORT C
PC3-PC0 Lower nibble of PORT C
RD Read
WR-Write
CS-Chip Select
A0-A1 Address Lines
D0-D7 Data Lines carries DATA or Control
Word to/from processor
RESET Clears control word registers
Data Bus Buffer
This bi-directional 8-bit buffer is used to interface the 8255
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 information is transferred through the data
bus buffer.
Read/Write and Control Logic
This block is to manage all of the internal and external
transfers of both Data and Control words
It accepts inputs from the CPU Address and Control busses
and in turn, issues commands to both of the Control Groups
(CS) Chip Select
A "low" on this input pin enables the communication
between the 8255 and the CPU
(RD) Read
A "low" on this input pin enables 8255 to send the data
or status information to the CPU on the data bus
(WR) Write
A "low" on this input pin enables the CPU to write data
or control words into the 8255
(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
There is also a Control port from the
Processor point of view.
Its contents decides the working of
8255.
When CS (Chip select) is 0, 8255 is
selected for communication by the
processor.
The chip select circuit connected to the
CS pin assigns addresses to the ports
of 8255.
Control Word Register
8255 Modes of Operations
There are 2 basic modes of operations
I/O Mode (Mode 0,Mode1 & Mode2)
Bit Set Reset mode (BSR)
Two 8-bit ports ( port A and port B )and two 4-bit ports (port
C upper and lower ) are available. The two 4-bit ports can be
Collectively used as a third 8-bit port.
D7 D6 D5 D4 D3 D2 D1 D0
BHE# A0 Transfer
0 0 Not useful
0 1 Odd addressed byte on upper half of bus
1 0 Even addressed byte on lower half of bus
1 1 Not possible
Solution 1: Use only even addresses
Register Select
Circuit Diagram
D0-D7 D0-D7
A3 A0 8255
0
A4 A1 1
From A5 A2 2 PPI
138 3
CPU M/IO# E1
4
5
A0 E2 6
E3 7 CS
A7
A6
IORDC# RD#
IOWRC# WR#
A2 A1
A1 A0
Access to Interface Registers
Port B and C are programmed as Mode 0 input port.
Port A is programmed as Mode 0 simple latched output
port.
Write a code to implement the operation
PortA=PortB-PortC
Register Select
Circuit Diagram
D8-D15 D0-D7
A3 A0 8255
0
A4 A1 1
From A5 A2 2 PPI
138 3
CPU M/IO# E1
4
5
A0 E2 6
E3 7 CS
A7
A6
IORDC# RD#
IOWRC# WR#
A2 A1
A1 A0
Solution 3: Use consecutive even
and odd address
Register Select
D8-D15
BHE#
74
245
OE#
Y0
D0-D7
D0-D7
74
245
OE# 8255
PPI
A4 A0 CS
0
A3 A1 1
A2 A2 2
From 138 3
4
CPU M/IO#
A5
E1 5
E2 6
E3 7
A7
A6
IORDC#
RD#
IOWRC#
WR#
A1
A1
A0
A0
Example - Port addresses
Solution
Example Programming 8255
8255 PPI Contd.
Mode 0: Simple Input or Output
In this mode, ports A, B are used as two simple 8-bit I/O ports
port C as two 4-bit ports.
Each port can be programmed to function as simply an input port or
an output port. The input/output features in Mode 0 are as follows.
35
8255 PPI Contd.
Mode 1: Input or Output with Handshake
In this mode, handshake signals are exchanged between the MPU
and peripherals prior to data transfer.
The features of the mode include the following:
1. Two ports (A and B) function as 8-bit I/O ports.
They can be configured as either as input or output
ports.
2. Each port uses three lines from port C as handshake
signals.
The remaining two lines of Port C can be used for simple
I/O operations.
3. Input and Output data are latched.
4. Interrupt logic is supported. 36
Mode 1 (Strobed I/O mode)
In this mode hand shaking signals controls the i/o operation
Port C lines PC0,PC1 & PC2 provides the handshake signals
for port B
Port C lines P3,PC6 & PC7 provides the handshake signals for
port A
PC4 & PC5 can be used as independent I/O lines
00F4H PORT C
00F6H CONTROL
0000 1000
Out put control signal definition(Mode 1)
OBF(output buffer full)-when low,it indicates the CPU has
written data to output port
1 1 Control Word
Register
Initializing 8254 Programmable
Peripheral device
3. Add each of the internal addresses to the
system base address to determine the
system address of each of the parts of the
device. Note : addresses should be odd to connect
upper half of the data bus
D7 D6 D5 D4 D3 D2 D1 D0
SC1 SC0 RL1 RL0 M2 M1 M0 BCD
SC1 SC0
0 0 SELECT COUNTER 0
0 1 SELECT COUNTER1
1 0 SELECT COUNTER2
1 1 READ BACK
COMMAND
RW-READ/WRITE
RL1 RL0
0 0 COUNTER LATCH COMMAND
0 1 READ/WRITE LSB ONLY
1 0 READ/WRITE MSB ONLY
1 1 READ/WRITE LSB FIRST THEN
MSB
M-MODE
0 0 0 MODE0-int on terminal
count
0 0 1 MODE1-H/W one shot
X 1 0 MODE2- Pulse generator
X 1 1 MODE3- Square wave gen
1 0 0 MODE4- S/W triggered
strobe
1 0 1 MODE5-H/W triggered
strobe
BCD
0 COUNTER (HEX)
1 BINARY CODED DECIMAL
System Interface
f=1.5MHz,
T=1/1.5 X10-6=0.66 s
ii. For generating interrupt to the processor
after10ms, the 8253 is to be used in mode 0.
The OUT1 pin of 8253 is connected to
interrupt input of the processor.
Let us use counter 1 for this purpose, and
operate the 8253 in HEX count mode.
Number of T states required for 10ms delay
=10X10-3
/0.66x10-6
=15x103 =15000 states =3A98H
iii. For generating a 5ms quasistable state
duration, the count required is calculated first.
The counter 2 of 8253 is used in mode1, to
count in binary. The OUT2 signal normally
remains high after the count is loaded, till the
trigger is applied. After the application of
trigger signal, the output goes low in the
next cycle, count down starts and whenever
the count goes zero the output again goes
high.
8251 -USART
Receive data
System 1 System 2
Signal common
Asynchronous Communications
Data to be transmitted is sent out one
character at a time and the receiver end of the
communication line synchronization is
performed by examining synchronization bits
that are included at the beginning and at the
end of each character
Introduction to serial data transfer
- for sending the data over long distances, the standard telephone
system is a conventional path, because the wiring and connections
are already in place.
TxD TxD
CTS* CTS*
CD* CD*
DTR* DTR*
DSR* DSR*
DTE DCE DCE DTE
When the terminal has sent all the characters, it makes its
RTS* signal high.
This
cause the modem to unassert CTS* signal and stop
transmitting.
DMA Controller--a device that can control data transfers between an I/O
subsystem and a memory subsystem in the same manner that a processor
can control such transfers
DMA Controller Interfaced with the
CPU
Features of 8257
It is programmable,4 channel direct memory access controller
Each channel has a pair of 16 bit registers viz DMA address register and
terminal counter registers
Address register gives the address of the memory location & counter
specifies the number DMA cycles to be performed
It maintains a DMA cycle count for each channel and activates the TC
signal to indicate the peripheral that specified DMA cycles are completed
Pin Configuration
It has priority logic that resolves the
peripheral request. Can be programmed
in two modes either fixed or rotating mode
Chip Select(CS)
Hold Request(HRQ)-it is used for requesting the CPU to get the control of
the system bus
Hold Ack(HLDA) -indicates that CPU has granted the system bus
DREQ0 DREQ3 -these are DMA request
Terminal Count registers lower 14 bits are used count the required
number of DMA cycles
DMA CYCLES:
DMA Read:Data is transferred from memory to I/O devices
DMA write:Data is transferred from I/O device to memory
DMA Verify:Data is not transfer,Used by peripheral device to verify the data that has
been recently transferred .
Mode Register
If the TC stop bit is set to zero the channel is not disabled even after
the count reaches zero
B7- auto load bit is set enables channel 2 for repeat block chaining
operation.
Update flag is set when ch2 count reg is updated with the ch3 count reg
value
Rotating Priority
Example
Write an Initialization program to transfer of data from a peripheral to
memory for the following specification
1)Bytes to be transferred is 256 bytes
2)Memory starting address is 2050
3)Channel used is ch1
4)Priority Rotating
5)Extended write disabled
6)TC Stop Enabled
7)Addresses:
Mode set register is 88H
DMA address Register of Ch1 is 82H
Terminal Count Register of ch1 is 83H
Solution:
Mode set Command word:
0101 0 0 1 0= 52H