Intel 8255A PPI EEE 365 [FALL 2014] LECTURE ATANU K SAHA BRAC UNIVERSITY
EEE 365 : MICROPROCESSOR ATANU K SAHA A PPI BRAC UNIVERSITY The 8255A programmable peripheral interface (PPI) implements a general-purpose I/O interface Connects peripheral equipment to a microcomputer system bus The core's functional configuration is programmed by the system software External logic is not required to interface peripheral devices Features: Three 8-bit Peripheral Ports -Ports A, B, and C Three programming modes for Peripheral Ports: Mode 0 (Basic Input/Output), Mode 1 (Strobed Input/Output), and Mode 2 (Bidirectional) Total of 24 programmable I/O lines 8-bit bidirectional system data bus with standard microprocessor interface controls
EEE 365 : MICROPROCESSOR ATANU K SAHA A PPI INTERNAL BLOCK DIAGRAM BRAC UNIVERSITY A0A1 00PORT A 01PORT B 10PORT C 11CONTROL REGISTER Internal Address
EEE 365 : MICROPROCESSOR ATANU K SAHA 4 Methods of Parallel data Transfer BRAC UNIVERSITY a)Simple I/O b)Simple Strobe I/O c)Single handshake I/O d)Double handshake I/O DATA (a) STB DATA (b) STB DATA ACK (c) STB DATA ACK (d) Microprocessor 8086 PPI 8255A ACK Port Device STB Parallel Data lines Are you ready? I am ready There is valid data for you I received the data There is valid data for you I received the data There is valid data for you
EEE 365 : MICROPROCESSOR ATANU K SAHA A MODE BRAC UNIVERSITY Mode 0: Simple Input Output Mode 1: Single Handshaking (Port A/Port B) Mode 2: Bidirectional Handshaking (Port A) Port C pins will be used as handshake lines or signal Mode 0 does not need any additional control signal Mode 1 needs three handshaking control pin INTR: INTERRUPT REQUEST STB/ACK: STROBE OR ACKNOWLEDGE IBF/OBF: INPUT OR OUTPUT BUFFER FREE Mode 2 needs five handshaking control pin INTR (O):INTERRUPT REQUEST STB (I):STROBE ACK (I):ACKNOWLEDGE IBF (O):INPUT BUFFER FREE OBF (O):OUTPUT BUFFER FREE Mode 1 (input) INTR (O) IBF (O) STB (I) Mode 1 (output) INTR (O) OBF (O) ACK (I)
EEE 365 : MICROPROCESSOR ATANU K SAHA A MODE 0 BRAC UNIVERSITY RD, WR D7 - D0 A0 - A1 8255A CS B C A Address Bus Control Bus Data Bus PB7 - PB0 PC3 – PC0 PC7 – PC4 PA7 – PA0
EEE 365 : MICROPROCESSOR ATANU K SAHA A MODE 1 BRAC UNIVERSITY RD, WR D7 - D0 A0 - A1 8255A CS B PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 A Address Bus Control Bus Data Bus 8 8 PB7 - PB0 PA7 – PA0 INTR B IBF B STB B INTR A STB A IBF A I/O I/O OBF B ACK B I/O I/O ACK A OBF A OR OR OR OR OR OR Handshake Output Signals Handshake Input Signals PORT A, PORT B Control Signal
EEE 365 : MICROPROCESSOR ATANU K SAHA A MODE 2 BRAC UNIVERSITY RD, WR D7 - D0 A0 - A1 8255A CS B PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 A Address Bus Control Bus Data Bus 8 8 PB7 - PB0 PA7 – PA0 I/O I/O I/O INTR A STB A IBF A ACK A OBF A Bi-directional bus PORT B may be mode 0 or mode 1 PORT A Control I/O or PORTB Control
EEE 365 : MICROPROCESSOR ATANU K SAHA A CONTROL WORD (CW) BRAC UNIVERSITY There are two control word for 8055A PPI Mode Definition Control Word: Used to tell the device what mode you want the ports to operate in. Bit Set/Reset Control Word: Used when you want to set/reset the output on a pin of PORT C or when you want to enable the interrupt output signals for handshaking data transfer. Both control words are sent to the control register address of 8255A
EEE 365 : MICROPROCESSOR ATANU K SAHA A Mode set CW BRAC UNIVERSITY D7D6D5D4D3D2D1D0 GROUP B PORT C (lower) 1 = Input 0 = Output PORT B 1 = Input 0 = Output Mode Selection 0 = Mode 0 1 = Mode 1 GROUP A PORT C (upper) 1 = Input 0 = Output PORT A 1 = Input 0 = Output Mode Selection 00 = Mode 0 01 = Mode 1 1X = Mode 2 Mode set Flag 1 = Active
EEE 365 : MICROPROCESSOR ATANU K SAHA A PORT C set/reset CW BRAC UNIVERSITY D7XXXD3D2D1D0 Bit set/reset 1 = set 0 = reset Mode set Flag 0 = Active Bit select B B B2 Don’t care
EEE 365 : MICROPROCESSOR ATANU K SAHA A Instruction BRAC UNIVERSITY For a port device the system address is 16 bit (not 20 bit, because it is not memory mapped). So there are two dedicated instruction to read and write a port device IN OUT IN instruction is used to read data from a port. If an 8-bit port is used then the data will go to AL. On the other hand if a 16-bit port is read, the data will go to AX. There are two possible formats for IN instruction. Fixed port format IN AL, PORT_ADD ; for 8-bit IN AX, PORT_ADD ; for 16-bit Variable port format (port address is written in DX) IN AL, DX ; for 8-bit IN AX, DX ; for 16-bit
EEE 365 : MICROPROCESSOR ATANU K SAHA A Instruction BRAC UNIVERSITY OUT instruction is used to write data in a port. If an 8-bit port is used then the data will write from AL. On the other hand if a 16-bit port is read, the data will write from AX. There are two possible formats for OUT instruction. Fixed port format OUT PORT_ADD, AL ; for 8-bit OUT PORT_ADD, AX ; for 16-bit Variable port format (port address is written in DX) OUT DX, AL ; for 8-bit OUT DX, AX ; for 16-bit Variable port format has some advantage that the port address can be computed or dynamically determined in the program
EEE 365 : MICROPROCESSOR ATANU K SAHA A Initialization BRAC UNIVERSITY Example 1: Suppose an 8255A has the base address of A2F8 H. We want to initialize the 8255A as follows: PORT B as mode 1 input PORT A as mode 0 output POET C upper as inputs PORT C bit 3 as output Solution: Mode set CW : = 8E H Port A address: A2F8 H Port B address: A2FA H Port C address: A2FC H CW address: A2FE H To send mode-set CW: MOVAL, 8E H MOV DX, A2FE H OUT DX,AL