final 8255

42
Annushapriya.S / ECE

Upload: annusha

Post on 12-Nov-2014

1.344 views

Category:

Documents


6 download

DESCRIPTION

MICROPROCESSORS & MICROCONTROLLER..INTERFACING UNIT..KEEP CHECKING FOR UPDATES :)ANY ISSUES... WE WILL DISCUSS..I LOVE MICROPROC... AND U??!!:)

TRANSCRIPT

Page 1: Final 8255

Annushapriya.S / ECE

Page 2: Final 8255

M.P.U

ProgrammableInterface Device

Peripherals(Keyboard, mouse)

M.P.U

ProgrammableInterface Device

RD WR

Interfacing with 8085

Peripherals(Printer)

Annushapriya.S / ECE

Interfacing?? Method or piece of equipment for interconnecting units or systems which may not be directly compatible

Page 3: Final 8255

Characteristics - 8255

• Programmable parallel I/O device

• 40 pin ICBlock diagram - 8255

Ports

Data Bus Buffer

ControlLogic

8255-Programmable Peripheral Interface (PPI)

Annushapriya.S / ECE

Page 4: Final 8255

Port A

Ports

(8- bit parallel port)

(8- bit parallel port)

(4 - bit Port)

(4 - bit Port)

Port B

Port C

Port Cupper

Port Clower

Annushapriya.S / ECE

Page 5: Final 8255

Data Bus Buffer

• 8- bit Data line

• Bi-directional

• D7 – D0

Annushapriya.S / ECE

Page 6: Final 8255

Control Logic

• Consists of 6 Lines

( RD, WR, RESET, CS, A0, A1)

1. RD (Read)

• Enables read operation

• Active low

• Logic 0 – M.P.U. reads data from a selected I/O port of 8255

Annushapriya.S / ECE

Page 7: Final 8255

2. WR (Write)

• Enables write operation

• Active low

• Logic 0 – M.P.U. writes data into a selected I/O port of 8255 or control register

3. RESET

• Clear Control Register

• Active high

• Sets all ports in input mode

Annushapriya.S / ECE

Page 8: Final 8255

4. CS (Chip Select)

• Master chip select

5. A0 Specify one of I/O ports on control register6. A1

CS A1 A0 Selected

0 0 0 Port A

0 0 1 Port B

0 1 0 Port C

0 1 1 Control Reg.

1 X X Not selected

8255 – Chip Select Logic

Annushapriya.S / ECE

Page 9: Final 8255

Annushapriya.S / ECE

Block diagram - 8255

Page 10: Final 8255

A7A6A5A4A3A2

8255

A1A0

RDWR

RESET

CS

Port A (80 H)

Port C (82 H)

Port B (81 H)

cs HEX. Address

PortsA7 A6 A5 A4 A3 A2 A1 A0

1 0 0 0 0 0 0 0 80 H Port A

1 0 0 0 0 0 0 1 81 H Port B

1 0 0 0 0 0 1 0 82 H Port C

1 0 0 0 0 0 1 1 83 H Control Register

I/O Port Address

Annushapriya.S / ECE

Page 11: Final 8255

Control Word

• Contents of Control Register is known as Control Word

• Specify I/O functions for each port

• 8-bit length

Control Register

D7 D6 D5 D4 D3 D2 D1 D0

D7 0 (BSR Mode)

D7 1 (I/O Mode)

Annushapriya.S / ECE

Page 12: Final 8255

BSR(Bit Set Reset) Mode:

• Port C operates in bit set or reset mode• It doesn't affect Port A or Port B

I/O Mode:

•Mode 0 All ports (A, B, C) are simple I/O ports •Mode 1 Handshake mode where Ports A &/or B use bits from Port C as handshake•Mode 2 Port A is used for bi-directional data transfer engaging handshake signals from Port C; Port B can be set up either in Mode 0 or Mode 1

Annushapriya.S / ECE

Page 13: Final 8255

13

• While ports A, B, and C are used for I/O data, it is the control register that must be programmed to select the operation mode of the three ports A, B, and C. The ports of the 8255 can be programmed in any of the following modes

• It has three modes of operation

Page 14: Final 8255

14

• Simple I/O mode• Any of the ports A, B, CL, and CU can be

programmed as input or output• All bits are out or all are in

(there is no control of individual bits)

Page 15: Final 8255

15

Mode 1

• Simple I/O with handshaking capabilities• Ports A and B can be used as input or output

ports with handshaking capabilities • Handshaking signals are provided by the bits

of port C(the device provides the handshaking signals)

Page 16: Final 8255

16

• Bidirectional port A with handshaking capabilities

• Port A can be used as a bidirectional I/O port with handshaking capabilities whose signals are provided by port C. (the device provides the handshaking signals)

Page 17: Final 8255

17

• A unique feature of port C is that the bits can be controlled individually. BSR mode allows one to set to high or low any of PC0 to PC7 as shown in Figure below.

Page 18: Final 8255

18

• Program PC4 of the 8255 in the following Figure to generate a pulse of 50 ms with 50% duty cycle.

Page 19: Final 8255

19

• To program the 8255 in BSR mode, • bit D7 of the control word must be low. • For PC4 to be high, we need a control word of ‘0xxx1001". • Likewise, for low we would need “0xxx1000" as the control

word. • The x's are for "don't care" and generally are set to zero.

MVI A,09H ; load the control byte (PC4=1)OUT 93H ;set PC4 to high, sent to control regCALL DELAY ;time for the high part of pulse MVI A,08H ;load the control byte (PC4=0) OUT 93H ;set PC4 to low, sent to control regCALL DELAY ;time for the low part of pulse

Page 20: Final 8255
Page 21: Final 8255
Page 22: Final 8255

22

• Handshaking refers to the process of communicating back and forth between two intelligent devices

• 8255 handles handshaking signals (a powerful built in features of the 8255)

• Printers are good example for a device with handshaking capabilities

Page 23: Final 8255

23

PA

PC7

PC6

D0 – D7

STROBE

ACK

8255 Printer

Page 24: Final 8255

24

1. A byte of data is presented to the data bus of the printer.

2. The printer is informed of the presence of a byte of data to be printed by activating its STROBE input signal.

3. Whenever the printer receives the data it informs the sender by activating an output signal called ACK (acknowledge).

4. The ACK signal initiates the process of providing another byte of data to the printer.

Page 25: Final 8255

25

• The 8255 can be programmed to receive data through ports A and B using handshaking signals through port C

• The signals are as follows:

Page 26: Final 8255

26Inputting data with handshaking signals (mode

1)

Page 27: Final 8255

From the fig, A and B are configured as input ports PORT A uses upper three signals PC3,PC4 and PC5.PORT B uses lower three signals PC0,PC1 and PC2.

Page 28: Final 8255

28

• Active-low input signal. • When an external peripheral device provides

a byte of the data to an input port (A or B), it informs the 8255 through the STB pin that PERIPHERAL HAS TRANSMITTED and it can load (latch in) the data into its internal register

• This signal goes low (active), stays low for a time, and goes back high. The amount of time it stays low depends on the device.

Page 29: Final 8255

STB

The 8255 in response to strobe generates IBF and INTR

Page 30: Final 8255

30

• Active-high output signal. • In response to STB, the 8255 latches into its

internal register the data present at PA0-PA7 or PB0-PB7, and through IBF indicates that it has latched the data, but it has not been read by the CPU yet

• To get the attention of the CPU to read the data, IBF activates INTR (sets it high).

Page 31: Final 8255

31

• Active-high output signal to interrupt the CPU. • If INTE =1 , STB’=1, IBF=1• When IBF goes active, INTR is activated (set to high) to

inform the CPU that there is a byte of data in the 8255. • Either an interrupt or polling the status word can be

used to read the data from port A or B. • It is only when the CPU reads the data by activating

the RD (going low) signal of the 8255 that INTR becomes inactive (the falling edge of RD makes INTR go low)

Page 32: Final 8255

32

• The RD signal from the CPU is of limited duration and when it goes high, the 8255 in turn makes IBF inactive by setting it low.

• IBF informs the peripheral device that the byte of data was latched by the 8255 and transferred to the CPU as well.

• By receiving IBF, the external device knows it can send another byte to the 8255's port A or port B.

• Then it sets low STB, and the process is repeated. • Notice that INTR is set to one when all three signals

STB, IBF, and INTE are high.

Page 33: Final 8255

33

• The CPU services various devices. There are two ways for the CPU to provide service to those devices: interrupts and polling.

• In the interrupt method, whenever any device needs its service, the device informs the CPU by sending it an interrupt signal. The CPU interrupts whatever it is doing and serves the request for service.

• In polling, the CPU continuously monitors a status condition and when the conditions are met it will perform the service.

• The advantage of interrupts is that the CPU can serve many devices (of course, not all at the same time). Each device receives service from the CPU based on the priority assigned to it. It can also ignore (mask) a device request for service.

• The disadvantage of interrupts is that they require much more hardware and software.

• In contrast, polling is cheap and requires minimal software, but it ties down the CPU. To avoid tying down the CPU, interrupts are the preferred choice.

Page 34: Final 8255

34

• INTE (interrupt enable)• An internal flip-flop can be used to enable or disable

(mask) INTR generation. It is controlled by PC4 and PC2 in BSR mode.

• To control INTEa and INTEb, use PC4 and PC2, respectively.

• Status word• To allow implementation of polling, the status of the

handshaking signals provided by port C can be checked by reading port C.

Page 35: Final 8255

35

• As shown, A and B can be used as output ports to send data to a device with handshaking signals.

• The handshaking signals for both ports A and B are provided by the bits of port C.

Page 36: Final 8255

36Outputting data with handshaking signals (mode 1)

Page 37: Final 8255

37

• Active-low signal going out of PC7 • Indicate that the CPU has written a byte of

data into port A, so the receiving peripheral device can read it

• OBFa must be connected to STROBE of the receiving equipment (such as a printer)

Page 38: Final 8255

38

• Active-low signal (Has limited duration)• Received at PC6 of the 8255• Indicates that the data at port A has been

picked up by the receiving device • The 8255 in turn makes OBFa high, to indicate

that the data at the port is old data• OBFa will not go low until the CPU writes a

new byte of data to port A

Page 39: Final 8255

39

• Active-high signal coming out of PC3• Activated by the rising edge of ACK which is

active for a short period of time• Signal on INTRa can be used to get the

attention of CPU (printer has received the last byte and is ready to receive another one)

• INTRa interrupts the CPU to write the next byte to port A to be printed.

Page 40: Final 8255

40

• 8255 can disable INTRa to prevent it from interrupting the CPU

• INTEa is an internal flip-flop designed to mask (disable) INTRa

• INTEa can be set or reset through port C in BSR mode since the INTEa flip-flop is controlled through PC6

• INTEb is controlled by PC2 in BSR mode

Page 41: Final 8255

41

• 8255 enables monitoring the status of signals INTR, OBF, and INTE for both ports A and B

• This is done by reading port C into the accumulator and testing the bits

• This feature allows the implementation of polling

Page 42: Final 8255

42

• The CPU services various devices. There are two ways for the CPU to provide service to those devices: interrupts and polling.

• In the interrupt method, whenever any device needs its service, the device informs the CPU by sending it an interrupt signal. The CPU interrupts whatever it is doing and serves the request for service.

• In polling, the CPU continuously monitors a status condition and when the conditions are met it will perform the service.

• The advantage of interrupts is that the CPU can serve many devices (of course, not all at the same time). Each device receives service from the CPU based on the priority assigned to it. It can also ignore (mask) a device request for service.

• The disadvantage of interrupts is that they require much more hardware and software.

• In contrast, polling is cheap and requires minimal software, but it ties down the CPU. To avoid tying down the CPU, interrupts are the preferred choice.