Unit - IV_ppi

Embed Size (px)

Citation preview

  • 8/8/2019 Unit - IV_ppi

    1/33

    Unit - IV

    8255 PPI

    - Programmable Peripheral

    Interfacing

  • 8/8/2019 Unit - IV_ppi

    2/33

    Programmable Peripheral Interface

    PPI expands number of parallel ports

    Intel 8255 has three 8-bit ports: Port A, B, C and a Control

    register

    Ports A and B can be programmed as either input or output. Ports A and C can be used as bidirectional

    Port C can be programmed as a pair of 4-bit bidirectional

    control ports or individual lines can be set or reset

  • 8/8/2019 Unit - IV_ppi

    3/33

    PPI cont

    Control register controls the overall operation of 8255

    All three ports A, B and C are grouped into two

    Group BGroup A

    Port A Upper C Port BLower C

  • 8/8/2019 Unit - IV_ppi

    4/33

    PPI cont..

    it can operate in two basic modes

    Bit set/reset mode (BSR)

    I/O Mode:

    mode 0,

    mode 1,

    mode 2

    Bit 8 of Control register decides between 3-

    mode operation or bit set/reset operation

  • 8/8/2019 Unit - IV_ppi

    5/33

    Operation modes

    8255 has three modes:

    - mode 0: basic input-output

    - mode 1: strobed input-output

    - mode 2: strobed bidirectinal bus I/O

    In mode 0

    - two 8-bit ports and two 4-bit ports

    - any port can be input or output

    - Outputs are latched, inputs are not latched

  • 8/8/2019 Unit - IV_ppi

    6/33

    Mode 0

    Port A Upper C Port BLower C

  • 8/8/2019 Unit - IV_ppi

    7/33

    Operation mode 1

    In mode 1:

    -three ports are divided into two groups

    -each group contains one 8-bit port and one 4-bit control/data

    port

    - 8-bit port can be either input or output and both latched- 4-bit port used for control and status of 8-bit data port

  • 8/8/2019 Unit - IV_ppi

    8/33

    Mode 1

    Group BGroup A

    Port A Upper C Port BLower C

  • 8/8/2019 Unit - IV_ppi

    9/33

    In mode 2

    - only port A is used

    - port A becomes an 8-bit bidirectional bus

    - port C acts as control port (only pins PC3-PC7 are used)

    Operation mode 2

  • 8/8/2019 Unit - IV_ppi

    10/33

    Mode 2

    Port A C7-C3 Port B

  • 8/8/2019 Unit - IV_ppi

    11/33

    Address mapping of ports and control register

    8255 PPI

    8255 control registerp $106F

    Port Ap $106C

    Port Bp $106D

    Port Cp $106E

  • 8/8/2019 Unit - IV_ppi

    12/33

    Block Diagram of 8255

  • 8/8/2019 Unit - IV_ppi

    13/33

    Pin Diagram

  • 8/8/2019 Unit - IV_ppi

    14/33

    Control word register :

  • 8/8/2019 Unit - IV_ppi

    15/33

    on ro reg s er

    D7 D6 D5 D4 D3 D2 D1 D0

    7 6 5 4 3 2 1 0

    Port A 1 Input 0 output

    Mode select: 00 mode 0;

    01 mode 1; 0x mode 21 mode select

    0 bit set/reset

    Port C(U) 1 Input 0 output

    Mode select: 0 mode 0;1 mode 1

    Port B 1 Input 0 output

    Port C(L) 1 Input

    0 output

    Group A

    Group B

  • 8/8/2019 Unit - IV_ppi

    16/33

    InitialisingControl Register

    Control word: Port A input and port B output and both port in mode 0

    A B

    7 6 5 4 3 2 1 0

    1 0 0 1 x 0 0 x

  • 8/8/2019 Unit - IV_ppi

    17/33

    Programming 8255

    Mode 0:

    Ports A, B, and C can be individually programmed as input or output ports

    Port C is divided into two 4-bit ports which are independent from each other

    Mode 1:

    Ports A and B are programmed as input or output ports

    Port C is used for handshaking

    PA[7:0]

    STBAIBFAINTRAPC3

    PC5PC4

    PB[7:0]STBBIBFBINTRBPC0

    PC1PC2

    PC6, 7

    8255

    PA[7:0]

    OBFAACKAINTRAPC3

    PC6PC7

    PB[7:0]OBFBACKBINTRBPC0

    PC1PC2

    PC4, 5

    8255

  • 8/8/2019 Unit - IV_ppi

    18/33

    Input Control signals:

  • 8/8/2019 Unit - IV_ppi

    19/33

  • 8/8/2019 Unit - IV_ppi

    20/33

    Output Control Signals:

  • 8/8/2019 Unit - IV_ppi

    21/33

  • 8/8/2019 Unit - IV_ppi

    22/33

    Programming 8255

    Mode 2:

    Port A is programmed to be bi-directional Port C is for handshaking

    Port B can be either input or output in mode 0 or mode 1

    PA[7:0]

    OBFAACKA

    INTRA

    PC4

    PC6PC7

    STBAIBFA

    PC0

    PC3

    PC58255

    PC0

    PC0

    PB[7:0]

    In Out

    In Out

    In Out

    Mode 0

    STBB OBFBIBFB ACKBINTRB INTRB

    Mode 1

    1. Can you design a decoder for an 8255 chip such that its base address is 40H?

    2. Write the instructions that set 8255 into mode 0, port A as input, port B as output,

    PC0-PC3 as input, PC4-PC7 as output ?

  • 8/8/2019 Unit - IV_ppi

    23/33

    Control signals:

  • 8/8/2019 Unit - IV_ppi

    24/33

    Timing diagram is a combination of the Mode 1Strobed Input

    and Mode 1Strobed Output Timing diagrams.

  • 8/8/2019 Unit - IV_ppi

    25/33

    Interfacing 8255 to 8086 in I/O mapped I/O

    D0-D7D0-D7

    A0

    A1A2

    A1

    RD

    WRWR

    M/IO

    RST CS

    Port A

    Port B

    Port C

    A3

    A4A5

    A6

    A7

    RD

    A0

  • 8/8/2019 Unit - IV_ppi

    26/33

    D0-D7D0-D7

    A0

    A1A2

    A1

    Interfacing 8255 to 8086 in Memory mapped I/O

    A3

    A4

    A5

    A6

    A7

    A19

    WR

    M/IORD

    A0

    RD

    RST

    WR

    CS

    Port A

    Port B

    Port C

  • 8/8/2019 Unit - IV_ppi

    27/33

  • 8/8/2019 Unit - IV_ppi

    28/33

    Example Program

    Write a program for this traffic signal problem.

    ort8255-

    68HC11-

    based QP

    0

    1

    2

    3

    4

    5

    6

    7

    R

    +

    -

    +

    -

  • 8/8/2019 Unit - IV_ppi

    29/33

  • 8/8/2019 Unit - IV_ppi

    30/33

  • 8/8/2019 Unit - IV_ppi

    31/33

  • 8/8/2019 Unit - IV_ppi

    32/33

  • 8/8/2019 Unit - IV_ppi

    33/33

    Summary

    8255 has very friendly programming features

    Data can be sent and read to and from outer world via ports A,B

    and C

    Suitable for advanced applications