BRANCH-E & TC ENGG
SUBJECT-MICROPROCESSOR & MICROCONTROLLER
CHAPTER-4-MICROPROCESSOR BASED SYSTEM DEVELOPMENT AID
TOPIC-8255 PROGRAMMABLE PERIPHERAL INTERFACE
SEM-4TH
FACULTY-ER. ARADHANA DAS(LECT. E & TC ENGG DEPARTMENT)
AY-2021-2022, SUMMER-2022
PROGRAMMABLE PERIPHERAL INTERFACE
8255 PPI
Programmable Peripheral Interface
2
Intel 8255 PPI
PPI – Programmable Peripheral Interface It is an I/O port chip used for interfacing I/O devices with microprocessor Very commonly used peripheral chip Knowledge of 8255 essential for students in the Microprocessors lab for Interfacing experiments |
3
About 82C55
82C55 : Pin Layout
8255 Control Word
Basic Mode Definitions and Bus Int
11-8
Programming 8255
9
8255 PPI contd.
3 ports in 8255 from user’s point of view - Port A, Port B and Port C. Port C composed of two independent 4-bit ports - PC7-4 (PC Upper) and PC3-0 (PC Lower) | ||
A1 | A0 | Selected port |
0 | 0 | Port A |
0 | 1 | Port B |
1 | 0 | Port C |
1 | 1 | Control port |
10
Intel 8255 PPI
A7
M/IO*
Chip Select Circuit
11
A7=0, A6=1, A5=1, A4=1, A3=1, A2=1, & M/IO*= 0
8255 PPI Contd.
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. For the chip select circuit shown, the chip is selected when A7=0, A6=1, A5=1, A4=1, A3=1, A2=1, & M/IO*= 0 Port A, Port B, Port C and Control port will have the addresses as 7CH, 7DH, 7EH, and 7FH respectively. |
12
8255 PPI Contd.
13
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.
�1. Outputs are latched.��2. Inputs are not latched.��3. Ports don’t have handshake or interrupt capability.�
8255 PPI Contd.
14
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 ort 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.
8255 PPI Contd.
15
Mode 2: Bidirectional Data Transfer ��This mode is used primarily in applications such as data transfer
between two computers.
In this mode, Port A can be configured as the bidirectional port
Port B either in Mode 0 or Mode 1.
Port A uses five signals from Port C
as handshake signals for data transfer.
The remaining three signals from port C can be used either
as simple I/O or as handshake for port B.�
8255 Handshake signals
Where are the Handshake signals? Port C pins act as handshake signals, when Port A and Port B are configured for other than Mode 0. Port A in Mode 2 and Port B in Mode 1 is possible, as it needs only 5+3 = 8 handshake signals After Reset of 8255, Port A , Port B , and Port C are configured for Mode 0 operation as input ports. |
16
8255 Handshake signals Contd.
PC2-0 are used as handshake signals by Port B when configured in Mode 1. This is immaterial whether Port B is configured as i/p or o/p port. PC5-3 are used as handshake signals by Port A when configured as i/p port in Mode 1. PC7,6,3 are used as handshake signals by Port A when configured as o/p port in Mode 1. PC7-3 are used as handshake signals by Port A when configured in Mode 2. |
17
8255 PPI Contd.
Port A can work in Mode 0, Mode 1, or Mode 2 Port B can work in Mode 0, or Mode 1 Port C can work in Mode 0 only, if at all Port A, Port B and Port C can work in Mode 0 Port A and Port B can work in Mode 1 Only Port A can work in Mode 2 |
18
8255 MD Control word
Control port having Mode Definition (MD) control word | |||||||||||
1 | M2A | M1A | I/P A | I/P CU | M1B | I/P B | I/P CL | ||||
Means Mode Definition control word | 1 - PCU as input 0 - PCU as output 1 - PA as input 0 - PA as output | 1 -PCL as input 0 -PCL as output 1 - PB as input 0 - PB as output 1 – Port B in Mode 1 0 – Port B in Mode 0 | |||||||||
M2A M1A | | ||||||||||
0 0 | Port A in Mode 0 | | |||||||||
0 1 | Port A in Mode 1 | | |||||||||
1 0/1 | Port A in Mode 2 | | | | | ||||||
19
8255 MD Control word Contd.
Ex. 1: Configure Port A as i/p in Mode 0, Port B as o/p in mode 0, Port C (Lower) as o/p and Port C (Upper) as i/p ports. | ||||||||||||
Required MD control word: | | | | | | |||||||
| | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | = | 98H | |
MD control | | | | | | | PC Lower as o/p | |||||
| PA in Mode 0 | | | | PB as o/p Reqd. instrns. | |||||||
| | PA as i/p | | PB in Mode 0 | MOV AL, 98H | |||||||
| | | | | | PC Upper as i/p | OUT 7FH, AL | |||||
20
8255 MD Control word Contd.
Ex. 2: Configure Port A as i/p in Mode 1, Port B as o/p in mode 1, Port C7-8 as i/p ports. (PC5-0 are handshake lines, some i/p lines and others o/p. So they are shown as X) | |||||||||||||
Required MD control word: | | | | | | ||||||||
| | 1 | 0 | 1 | 1 | 1 | 1 | 0 | X | = | BCH or BDH | ||
MD control | | | | | | | PC3-0 as don’t care | ||||||
| PA in Mode 1 | | | | PB as o/p Reqd. Instrns. | ||||||||
| | PA as i/p | | PB in Mode 1 | MOV AL,BCH | ||||||||
| | | | | PC Upper(C7-8) as i/p | OUT 7FH, AL | |||||||
21
8255 PCBSR Control word contd.
Ex. 2: Reset to 0 bit 6 of Port C | ||||||||||||||||
| | 0 | X | X | X | 1 | 1 | 0 | 0 | = | 0CH,… | |||||
PC bit set / reset control word | | | | Bit 6 of PC | Reset to 0
| |||||||||||
Don’t cares | ||||||||||||||||
| | | Required instructions | |||||||||||||
| | | | | | MOV AL, 0CH | ||||||||||
| | | | | | | | | OUT 7FH, AL | | | |||||
| | | | | | | | | | | | |||||
| | | | | | | | | | |||||||
22
8255 PCBSR Control word contd.
Ex. 1: Set to 1 bit 4 of Port C | ||||||||||||||||
| | 0 | X | X | X | 1 | 0 | 0 | 1 | = | 09H,… | |||||
PC bit set / reset control word | | | | Bit 4 of PC | Set to 1
| |||||||||||
Don’t cares | ||||||||||||||||
| | | Required instructions | |||||||||||||
| | | | | | MOV AL, 09H | ||||||||||
| | | | | | | | | OUT 7FH, AL | | | |||||
| | | | | | | | | | | | |||||
| | | | | | | | | | |||||||
23
INTERFACING WITH STEPPER MOTOR
ROTATION PER SEQUENCE = 360/NT
NT= NUM.OF TURNS
FOUR PATTERN SWITCHING SEQUENCE
W4 | W3 | W2 | W1 |
0 | 0 | 1 | 1 |
1 | 0 | 0 | 1 |
1 | 1 | 0 | 0 |
0 | 1 | 1 | 0 |
0 | 0 | 1 | 1 |
CLOCK WIS
ANTI-CLOCK
24
Stepper motor interface Diagram
25