Upload
crsarin
View
216
Download
0
Embed Size (px)
Citation preview
7/28/2019 lec 3M&A
1/18
1
82C55
ProgrammablePeripheralInterface
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
2/18
2
Protocols
3 methods to transfer data from one device toother exists in micro computers.
1. Programmed I/O or Basic I/O
When data transferred between two devices is based on theexecution of data transfer program, without exchanging
any handshake signals before or after data transfer.2. Hand shaking I/O
Before transferring the data between two devices , few handshaking signals are exchanged between the two entitiesto ensure the readiness of device for the upcoming data& few hand shaking signals are exchanged after the data
transfer to signal the receiving side that data transfer isfinished.
3. Direct memory access (DMA)
Already studied.
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
3/18
3
About 82C55
It is used to interface 8 bit parallel I/Odevice to a microprocessor.
It is used to interface to the keyboardand a parallel printer port in PCs.
PPI has 24 pins for I/O that areprogrammable in groups of 12 pinsand has three distinct modes ofoperation.
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
4/18
4
82C55 : Pin Layout
3/
30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
5/18
5
Control register for mode
Programming 82C55
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
6/18
Mode 0
Port A Upper C Port BLower C
3/30/2013 6Micro processor & assemblylanguage
7/28/2019 lec 3M&A
7/18
7
Mode 0 (Basic Input/Output).
This mode provides simple input and
output operations for each of the three
ports.
No handshaking is required, data is
simply written to or read from a specified
port.
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
8/18
8
82C55: Mode 0, 7 segment multiple
digit Display
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
9/18
9
82C55: Mode 0, 7 segment multiple
digit Display
Port A provides the segment data inputs to
display and port B provides a means of
selecting one display position at a time.
Different values are displayed in each digit
via fast time division multiplexing.
3/30/2013 Micro processor & assemblylanguage
http://www.google.com.pk/imgres?imgurl=http://www.johnloomis.org/altera/DE2/segments.jpg&imgrefurl=http://www.johnloomis.org/altera/DE2/seven_segment.html&usg=__JfjGFPE-My5xgZ1H83mralQq0xc=&h=529&w=292&sz=20&hl=en&start=15&zoom=1&itbs=1&tbnid=ZWTp2n_x5tEUnM:&tbnh=132&tbnw=73&prev=/images%3Fq%3Dseven%2Bsegment%2Bdisplay%26hl%3Den%26sa%3DX%26tbs%3Disch:1%26prmd%3Divns7/28/2019 lec 3M&A
10/18
10
82C55: Mode 0, Scan Key of Hex
Key board
Row # Col #Data saved
as3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
11/18
Debouncing
When a key is depressed, its contact
bounces for a short period of time. This
problem is overcome by either using
hardware de-bouncer or sampling the keysecond time a bit later to assure that the
same key is depressed.
3/30/2013 11Micro processor & assemblylanguage
7/28/2019 lec 3M&A
12/18
More than one key of a row is
depressed Techniques to overcome the problem
1. Two key lock out:
During the second scan (after bouncing time is over),if still two keys of a row are found depressed, both
keys will be locked out & neither is accepted bythe P. However if any one of them is releasedafter first scan, the second key still depressed willbe accepted by P.
2. N key roll over:During the second scan (after bouncing time is over),if still more than one key is found depressed, theyare accepted by the P. The key entries areaccepted in the order in which they were pressed.
3/30/2013 12Micro processor & assemblylanguage
7/28/2019 lec 3M&A
13/18
Mode 1
Group BGroup A
Port A Upper C Port BLower C
3/30/2013 13Micro processor & assemblylanguage
Hand shaking
signals
7/28/2019 lec 3M&A
14/18
14
Mode 1 Basic functional
Definitions Two Groups (Group A and Group B).
The 8-bit data port can be either input or output.
Pins of port C provide Hand shaking signals.
3/30/2013 Micro processor & assemblylanguage
7/28/2019 lec 3M&A
15/18
15
82C55: Mode 1 Input Exam.
Keyboard encoder encodes the key-switch into8 bit ASCII code whenever a key is depressed.
DAV (Data Available) is activated on a key
press, strobing the ASCII-coded key code intoPort A.
3/30/2013 Micro processor & assemblylanguage
PC 3
8086
IBF (input bufferfull)
PC 5
INTR
7/28/2019 lec 3M&A
16/18
1611-16
Example: Mode 1 output
Printer
PB0
PB7
ACKPC2 ACK
8255
PC4 DS
Data Strobe : to tell
the printer to latch the
incoming data.
Generated Externally
3/30/2013 Micro processor & assemblylanguage
8086 INTR
PC 0
1
7/28/2019 lec 3M&A
17/18
Mode 2
Port A C7-C3 Port B
3/30/2013 17Micro processor & assemblylanguage
Hand shaking
signalsBidirectional 8 bit
I/O port
Uni directional port with
or without handshaking
7/28/2019 lec 3M&A
18/18
18
82C55: Mode 2 Bi-directionalOperation
In this mode data is transmitted in both
directions between the 8255 & the peripheral
devices on port A.
Handshaking signals are provided to maintainproper bus flow discipline in a similar manner to
MODE 1.
Port B can be only configured for mode 0 or 1.
3/30/2013 Micro processor & assemblylanguage