82c55 programmable peripheral interface ppi ·  · 2012-10-052012-10-05 · 82c55 programmable...

37
82C55 Programmable Peripheral Interface PPI 3

Upload: dinhthien

Post on 17-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

82C55 Programmable

Peripheral InterfacePPI

3

82C55 programmable peripheral interface

4

a popular, low-cost interface component found in manyapplications.

The PPI has 24 pins for I/O, programmable in groups of 12 pins andgroups that operate in three distinct modes of operation.

82C55 can interface any TTL-compatible I/O device to themicroprocessor.

The 82C55 (CMOS version) requires wait states if operated with aprocessor using higher than an 8 MHz clock.

82C55 programmable peripheral interface

5

Because I/O devices are inherently slow, wait states used duringI/O transfers do not impact significantly upon the speed of thesystem.

The 82C55 still finds application even in the latest Core2-basedcomputer system.

An experimentation board is available that plugs into the parallelport of a PC, to allow access to an 8255 located on the board.

o The 8255 is programmed in either assembly language or VisualC++ through drivers available with the board.

82C55 programmable peripheral interface

6

82C55 is used for interface to IO devices in many PCs.

o found as a function within an interfacing chip set

o 82C55 is interfaced to keyboard control at port addresses60H–63H.

o also for controlling the speaker, timer, and other internaldevices such as memory expansion

o It is also used for the parallel printer port at I/O ports 378H–37BH.

82C55 programmable peripheral interface

7

Basic Description of the 82C55

o The three I/O ports (labeled A, B, andC) are programmed as groups.

o group A connections consist of port A(PA7–PA0) and the upper half of port C(PC7–PC4)

o group B consists of port B (PB7–PB0)and the lower half of port C (PC3–PC0)

o 82C55 is selected by its CS pin forprogramming and reading/writing to aport.

82C55 programmable peripheral interface

8

Basic Description of the 82C55

o In the PC, a pair of 82C55s, or equivalents, are decoded at I/Oports 60H–63H and also at ports 378H–37BH.

o For 82C55 to be read or written, the CS input must be logic 0and the correct I/O address must be applied to the A1 and A0pins.

82C55 programmable peripheral interface

9

Basic Description of the 82C55

82C55 programmable peripheral interface

10

Basic Description of the 82C55

o it functions at 8-bit addresses C0H (port A), C2H (port B), C4H(port C), and C6H (command register).

o All 82C55 pins are direct connections to the X86, except theCS pin. The pin is decoded/selected by a 74ALS138 decoder.

o A RESET to 82C55 sets up all ports as simple input ports usingmode 0 operation.

o initializes the device when the processor is reset

o After a RESET, no other commands are needed, as long as it isused as an input device for all three ports.

82C55 programmable peripheral interface

11

Programming the 82C55

82C55 programmable peripheral interface

12

Programming the 82C55

o 82C55 is programmed through two internal command registers.

o Bit position 7 selects either command byte A or command byte B.

o command byte A programs functions of group A and B

o command byte B sets (1) or resets (0) bits of port C only if the 82C55 is programmed in mode 1 or 2

o Group B (port B and the lower part of port C) are programmed as input or output pins.

82C55 programmable peripheral interface

13

Programming the 82C55

o Group B operates in mode 0 or mode 1

o Mode 0 is basic input/output mode that allows the pins ofgroup B to be programmed as simple input and latchedoutput connections

o buffered input device

o latched output device

o Mode 1 operation is the strobed operation for group Bconnections

o data are transferred through port B

o handshaking signals are provided by port C

82C55 programmable peripheral interface

14

Programming the 82C55

o Group A (port A and the upper part of port C) areprogrammed as input or output pins.

o Group A can operate in modes 0, 1, and 2.

o mode 2 operation is a bidirectional mode of operation forport A

o If a 0 is placed in bit position 7 of the command byte,command byte B is selected

o This allows any bit of port C to be set (1) or reset (0), if the82C55 is operated in either mode 1 or 2.

o otherwise, this byte is not used for programming

82C55 programmable peripheral interface

15

Programming the 82C55: Mode 0 Operation

o Example 1: 82C55 connected to a set of eight seven-segmentLED displays. (standard LEDs)

o ports A & B are programmed as (mode 0)

o port A provides segment data inputs port B provides ameans of selecting one display position at a time formultiplexing the displays

o Ports A and B are programmed as simple latched outputports.

82C55 programmable peripheral interface

16

Programming the 82C55: Mode 0 Operation

Address Decoder

700H

Example 1

82C55 programmable peripheral interface

17

Programming the 82C55: Mode 0 Operation

o Example 1 : 82C55 connected to a set of eight seven-segment

82C55 programmable peripheral interface

18

Programming the 82C55: Mode 0 Operation

o Example 2 : 82C55 connected to a Stepper Motor

o Another device often interfaced to a computer system isthe stepper motor.

o a digital motor because it is moved in discrete steps asit traverses through 360°

o An inexpensive stepper motor is geared to move perhaps15° per step. A more costly, high-precision stepper motorcan be geared to 1° per step.

o In all cases, these steps are gained through manymagnetic poles and/or gearing.

82C55 programmable peripheral interface

19

Programming the 82C55: Mode 0 Operation

o Example 2 : 82C55 connected to a Stepper Motor

o Two coils are energized at a time, causing the motor tostep at 45°, 135°, 225°, and 315°.

o The motor is shown with the armature rotated to fourdiscrete places, called full stepping.

o accomplished by energizing the coils, as shown

82C55 programmable peripheral interface

20

Programming the 82C55: Mode 0 Operation

o Example: 82C55 connected to a Stepper Motor

82C55 programmable peripheral interface

21

Programming the 82C55: Mode 0 Operation

o Example: 82C55 connected to a Stepper Motor

o The motor is driven by NPN Darlington amp pairs toprovide a large current to each coil.

o This circuit uses the 82C55 to provide drive signals used torotate the motor armature in either the right- or left-handdirection.

82C55 programmable peripheral interface

22

Programming the 82C55: Mode 0 Operation

o Example: 82C55 connected to a Stepper Motor

82C55 programmable peripheral interface

23

Programming the 82C55: Mode 0 Operation

o Example 3 : 82C55 connected to a Key Matrix

o a key matrix with 16 switches interfaced to ports A and Bof an 82C55.

o The keys are organized into four rows and columns:(ROW0–ROW3) (COL0–COL3)

o port A is programmed as an input port to read the rows

o port B is programmed as an output port to select acolumn

82C55 programmable peripheral interface

24

Programming the 82C55: Mode 0 Operation

o Example 3 : 82C55 connected to a Key Matrix

Address Decoder

Code is reading assignment

82C55 programmable peripheral interface

25

Programming the 82C55: Mode 1 Strobed Input

o Causes port A and/or port B to function as latching inputdevices.

o allows external data to be stored to the port until themicroprocessor is ready to retrieve it

o Port C is used in mode 1 operation—not for data, but forcontrol or handshaking signals.

o to help operate either or both port A and B as strobedinput ports

82C55 programmable peripheral interface

26

Programming the 82C55: Mode 1 Strobed Input

general-purpose I/O pins

82C55 programmable peripheral interface

27

Programming the 82C55: Mode 1 Strobed Input

o STB: The strobe input loads data to the port latch, whichholds the information until it is input to the microprocessorvia the IN instruction.

o IBF: Input buffer full is an output indicating that the inputlatch contains information.

o INTR: Interrupt request is an output that requests aninterrupt. The INTR pin becomes a logic 1 when STB returns toa logic 1. Cleared when data are input from the port by theprocessor.

o INTE: Interrupt enable signal is neither input nor output; it isan internal bit programmed via port PC4 (port A) or PC2 (portB) bit position.

82C55 programmable peripheral interface

28

Programming the 82C55: Mode 1 Strobed Input

o An example of a strobed input device is a keyboard.

o The keyboard encoder de-bounces the key switches andprovides a strobe signal whenever a key is depressed.

o the data output contains ASCII-coded key code

82C55 programmable peripheral interface

29

Programming the 82C55: Mode 1 Strobed Output

o Strobed output operation is similar to mode 0 outputoperation.

o except control signals are included to provide handshaking

o When data are written to a strobed output port, the outputbuffer full signal becomes logic 0 to indicate data are presentin the port latch.

82C55 programmable peripheral interface

30

Programming the 82C55: Mode 1 Strobed Output

82C55 programmable peripheral interface

31

Programming the 82C55: Mode 1 Strobed Output

o OBF: Output buffer full goes low whenever data are output(OUT) to the port A or B latch. The signal is set to logic 1 whenthe ACK pulse returns from the external device.

o ACK: The acknowledge signal causes the OBF pin to return tologic 1. The ACK signal is a response from an external device,indicating that it has received data from the 82C55 port.

o INTR: Interrupt request often interrupts the processor whenthe external device receives the data via the ACK signal.Qualified by the internal INTE (interrupt enable) bit.

o INTE: Interrupt enable is neither input nor output; it is aninternal bit programmed to enable or disable the INTR pin.INTE A is programmed using PC6 bit. INTE B is programmedusing the PC2 bit.

82C55 programmable peripheral interface

32

Programming the 82C55: Mode 1 Strobed Output

o Example: The printer interface demonstrates how to achievestrobed output synchronization between the printer and the82C55.

82C55 programmable peripheral interface

33

Programming the 82C55: Mode 2 Bidirectional Operation

o Mode 2 is allowed with group A only.

o Port A becomes bidirectional, allowing data transmit/receiveover the same eight wires.

o useful when interfacing two computers

o Also used for IEEE-488 parallel high-speed GPIB (general-purpose instrumentation bus) interface standard.

o The bidirectional bus is used by referencing port A with the INand OUT instructions.

82C55 programmable peripheral interface

34

Programming the 82C55: Mode 2 Bidirectional Operation

o The state of the INTR pin is controlled through port C bits PC6(INTE1) and PC4 (INTE2).

82C55 programmable peripheral interface

35

Programming the 82C55: Mode 2 Bidirectional Operation

o To transmit data through the bidirectional bus, the program first tests to determine whether the output buffer is empty.

o if so, data are sent to the output buffer via OUT

o The external circuitry also monitors the signal to decide whether the microprocessor has sent data to the bus.

o To receive data through the bidirectional port A bus, IBF is tested with software to decide whether data have been strobed into the port.

o if IBF = 1, data is input using IN

82C55 programmable peripheral interface

36

Programming the 82C55: Mode 2 Bidirectional Operation

o The external interface sends data to the port by using the STB signal.

o the IBF signal becomes logic 1 and data at port A are held inside the port in a latch

o When the IN executes, the IBF bit is cleared and data in the port are moved into AL.

o The INTR (interrupt request) pin can be activated from both directions of data flow through the bus.

o If INTR is enabled by both INTE bits, the output and input buffers both cause interrupt requests.

o This occurs when data are strobed into the buffer using STB or when data are written using OUT.

82C55 programmable peripheral interface

37

Programming the 82C55: Mode 2 Bidirectional Operation

82C55 programmable peripheral interface

38

Programming the 82C55: Mode 2 Bidirectional Operation

82C55 programmable peripheral interface

39

Programming the 82C55: Mode Summary