Вы находитесь на странице: 1из 12

CHAPTER- 8

(Part-I)
8155 PPI
(Programmable Peripheral Interface)

1
8155 (PPI)
• It is a multifunction device
designed to use in minimum mode
system
• It contain RAM, I/O ports and
Timer

2
Features
1. 2k static RAM cell organized as 256 bytes
2. 2 programmable 8 bit I/O ports (A,B)
3. 1 programmable 6 bit I/O port (c)
4. 1 programmable 14 bit binary down counter/timer
5. An internal address latch to de multiplex AD 0-
AD7 using ALE
6. Internal selection logic for memory & I/O. using
command register

3
4
Pin out
• ADo-AD7: address & data lines internally de
multiplex by using internal latch & ALE signal
address lines are used to access the memory or I/O
port depending on the status of IO/M pin i/p
• D0-D7 lines act as data bus
• ALE: used to de multiplex the AD0-AD7
• IO/M : used to differentiate between IO or memory
• CE : used to select the 8155
• RD : used to read the data from memory or I/O
• WR: used to write the data to memory or I/O
5
Cont’d…

• Reset: used to reset the 8155 IC


• PA0-PA7, PB0-PB7: Port A & Port B I/P 8 bit pins
they can be programmed either i/p or o/p port using
command register
• PC0-PC5: these are 6 bit I/O pins they can be used as
simple Input output port or control port when PA
and/or PB are used in handshake mode
• Timer in: this is an i/p to the timer
• Timer out : This is an o/p pin depending on the mode
of the timer o/p can be either a square wave or pulse.
• VCC, GND : +5v resp. to GND
6
I/O port or timer selection
IO/M A2 A1 A0
1 0 0 0 CWR
1 0 0 1 PORT A
1 0 1 0 PORT B
1 0 1 1 PORT C
1 1 0 0 TIMER LSB
1 1 0 1 TIMER MSB
0 MEMORY OPTION

7
Control Word of 8155
D7 D6 D5 D4 D3 D2 D1 D0
• D0=Port A 0=Input
• D1=Port B 1=Output
• D2 &D3 used with port C
• D4 (IEA= Interrupt Enable Port A) 1= Enable
• D5 (IEB= Interrupt Enable Port B) 0=
Disable
• D6&D7
D7 D6 used
timerin timer mode
commands
0 0 NOP
0 1 Stop counting if timer is running
1 0 Stop after TC (stop after at the count)
1 1 Start timer if is not running 8
Timer mode
MSB M2 M1 D13 D12 D11 D10 D9 D8

LSB D7 D6 D5 D4 D3 D2 D1 D0

• Mode 0: In this mode the timer o/p remains high for


half the count & goes low for the remaining count, thus
providing the single square wave. The pulse width is
determined by count and clk freq
• Mode 1: In this mode the initial count is automatically
reloaded at the end of each count. Provide the continuous
square wave.
• Mode 2: In this mode single clock pulse is provided at
the end of count
• Mode 3 This is similar to mode 2 except the initial count
is reloaded to provided a continuous wave form 9
For port C
D3 D2
0 0 = ALT 1(port C as Input mode)
1 1 = ALT 2(Port C as Output Mode)
0 1 = ALT 3 used in handshake mode
1 0 = ALT 4 along with Port A &B
Example 1
• Design a square wave generator with a pulse width of
100 µs by using the 8155 timer if clock freq is 3MHz.
Sol : T=1/F=1/3MHz=330ns
Timer count=pulse period/CLK period
= 200µs/330ns=606
count = 025Eh 10
• Assuming the port addresses
CWR=20h
Timer LSB=24h
Timer MSB=25h
Count =025Eh
• Therefore 5Eh must be load in the LSB timer
• Select mode 1 for square wave.
• Therefore 42h (01000010)must be load in the
MSB timer

11
Control word
• To start the timer D7 & D6 bit must be 1
• set the bit of CWR and send to address 20h
• therefore C0h (11000000) must be load in CWR
register.
• Program for square wave
MVI A,5Eh
OUT 24H
MVI A,42H
OUT 25H
MVI A,C0H
OUT 20H
HLT 12

Вам также может понравиться