2-8255A Interfacing
2-8255A Interfacing
11/04/23 1
Programmable Parallel Ports and
Handshake Input/Output
• Most of the available port devices, such as the 8255A
on the SDK-86 board, contain two or three ports
which can be programmed to operate in one of
several different modes
11/04/23 2
Digital Interfacing
Methods of parallel data transfer
8255A internal block diagram and
system connections
8255A operational modes and
initialization
Constructing and sending 8255A
control words. (Refer Text Book 2).
11/04/23 3
Methods of Parallel Data Transfer
11/04/23 4
1. Simple Input and Output
11/04/23 5
• Likewise, when we need to output data to a simple
display device such as an LED, all we have to do is
connect the input of the LED buffer on an output
port pin and output the logic level required to turn
on the light
11/04/23 6
2. Simple Strobe I/O
11/04/23 7
• When a key is pressed, circuitry on the keyboard
sends out the ASCII code for the pressed key on eight
parallel data lines, and then sends out a strobe signal
on another line to indicate that valid data is present
on the 8 data lines
11/04/23 8
• For low rates of data transfer, such as from a
keyboard to a microprocessor, a simple strobe
transfer works well
11/04/23 9
3. Single-Handshake I/O
MICRO- PORT
PERIPHERAL
PROCESSOR DEVICE
PARALLEL
DATA LINES
STB
ACK
11/04/23 10
• The peripheral outputs some parallel data and sends an
STB signal to the microprocessor
11/04/23 11
4. Double-Handshake Data Transfer
• The circuit connection is same as before
11/04/23 12
• The peripheral device then sends the byte of data
and raises its STB line high to say, “Here is some valid
data for you”
11/04/23 13
Implementing Handshake Data Transfer
• For handshake data transfer, a microprocessor can
determine when it is time to send the next data byte on
a polled or on an interrupt basis
11/04/23 14
8255A Internal Block Diagram and
System Connections
11/04/23 15
11/04/23 16
11/04/23 17
• The two groups of I/O pins are named as Group A and
Group B
11/04/23 18
• All of these ports can function independently either
as Input or as Output ports
11/04/23 19
• The read/write control logic manages all of the
internal and external transfers of both data and
control words
11/04/23 20
• 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
11/04/23 21
• PC3-PC0 : These are the lower port C lines, other details
are the same as PC7-PC4 lines
• 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
11/04/23 22
• CS : This is a chip select line. If this line goes low, it
enables the 8255 to respond to RD and WR signals,
otherwise RD and WR signal are neglected
• (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).
A1 A0 SELECTION
0 0 PORT A
0 1 PORT B
1 0 PORT C
1 1 CONTROL
11/04/23 23
11/04/23 24
• D0-D7 : These are the data bus lines those carry data
or control word to/from the microprocessor
11/04/23 25
8255A Operational Modes and
Initialization
• These are two basic modes of operation of 8255. I/O
mode and Bit Set-Reset mode (BSR).
11/04/23 26
MODE 0
• When you want to use a port for simple I/O without
handshaking, you initialize that port in mode 0.
• 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 combined and used as a third 8-bit port
11/04/23 27
Mode 1 – Strobed Input
• Mode 1 operation causes port A and/or port B to
function as latching or strobed input devices
11/04/23 28
• The strobed input port captures data from the port
pins when the strobe (STB) is activated
11/04/23 29
• The act of reading the port restores both IBF and
INTR to their inactive states until the next data is
strobed into the port
11/04/23 30
11/04/23 31
Timing Diagram – Mode 1 Strobed Input
11/04/23 32
• Out of 8-bit port C, PC0-PC2 are used to generate
control signals for port B and PC3-PC5 are used to
generate control signals for port A. the lines PC6, PC7
may be used as independent data lines
11/04/23 33
Mode 1 – Strobed Output
• Whenever data are written to a port programmed as
a strobed output port, the OBF (Output Buffer Full)
signal becomes a logic 0 to indicate that data are
present in the port latch
11/04/23 38
11/04/23 39
Timing Diagram - Mode 2
11/04/23 40
• To transmit data through the bi-directional bus, the
program first tests the OBF signal to determine
whether the output buffer is empty
• If it is, then data are sent to the output buffer via the
OUT instruction
11/04/23 41
• The external interface sends the data into the port
using the STB signal
11/04/23 42
11/04/23 43
11/04/23 44
Constructing and Sending
8255A Control Words
11/04/23 45
MODE SET CONTROL WORD
11/04/23 46
BIT SET / RESET CONTROL WORD
11/04/23 47
• To send this control word to the 8255A, load it
into AL, Point DX at the control register
address if DX is not already pointing to there,
and send the control word with the
OUT DX, AL instruction
11/04/23 48
1. Logic Controller
2. 7 Segment Display
3. Stepper Motor
4. DAC
5. KeyPad
6. Elevator
11/04/23 49
11/04/23 50
7 segment display
• The port C is used to trigger from high to low
• Each time triggering takes place, the bit is shifted in
D-flipflop.
• When the 32 bit bits are received the data is sent
parallelly to the 7-segment display( serial in parallel
out)
• The port B is used to send the data.
• To maintain the ordering of the data from PB0-PB7
to D)-D&, the data in PB0-PB7 is rotated left and
shifted bit is sent to D flip flop. For each trigger one
bit is sent
11/04/23 51
How to find 7-segment code for given character
or number
• There are two types of display
• Common anode: In order to glow particular
segment of a 7-segment display give 0 (low).
• Common cathode In order to glow particular
segment of a 7-segment display give 1(high).
• Note: in the lab we are using common anode
display
11/04/23 52
11/04/23 53
Stepper motor interface
11/04/23 54
• A-PA0
• B-PA3
• A’- PA2
• B’-PA1
• When current is passed through PA0 the electro magnet is
excited. The needle will point to this electromagnet.
(PA3,PA2,PA1,PA0 are 0001)
• whenever a current is passed through PA3 the electro
magnet is excited. The needle will point to this
electromagnet(PA3).(PA3,PA2,PA1,PA0 are 1000)
• This makes needle to move 900 there by making one
full step.
11/04/23 55
• To make a movement smooth both PA0 and
PA3 are excited so that needle moves by 450
There by making half step. Then PA3 is excited
to make a rotation of 900 (one fullstep).
For one full step of rotation stepper motor shaft
moves by 1.80
To move stepper motor shaft by ɵ0 the number
of moves =
Example: to move stepper motor shaft by 900
the number of moves =90/1.8=50 full steps
11/04/23 56
PA3 PA2 PA1 PA0
0 0 0 1
1 0 0 1
0 0 0 1
1 1 0 0
0 1 0 0
0 1 1 0
0 0 1 0
0 0 1 1
0 0 0 1
11/04/23 57
3*8 Key pad Interface
• PC0,PC1 and PC2 are used as output ports to pass current
• PA0 to PA7 are used as input ports to check which key is
pressed.
• Assume that the user has pressed the key 2.the switch will
connect the line from PC0 to PA2 and there will be a flow of
current through PA2 so the bit PA2 will be 1 and remaining
will be zero
• the logic is to pass current for the first row and check if any
key is pressed there. If PA0-PA7 are 0’s then that indicates
no key is pressed in first row. The current is passed to
second row by making PC1 as high.
• If any key is pressed then any one bit from PA0-PA7 will be
set to one
11/04/23 58
11/04/23 59
Thank You…
11/04/23 60
11/04/23 61