0% found this document useful (0 votes)
32 views21 pages

Interfacing With Periferals

Here are the steps to interface DIP switches with 8255 and display the reading on LEDs: 1. Port A address = 8000H 2. Port B address = 8001H 3. Port C upper address = 8002H 4. Mode 0 control word to configure: Port A and Port CU as output = 83H Port B and Port CL as input 5. Write a program: MVI A, 83H STA 8003H LDA 8001H STA 8000H LDA 8002H ANI 0FH RLC RLC RLC RLC STA 8002H HLT

Uploaded by

Sunil Acharya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views21 pages

Interfacing With Periferals

Here are the steps to interface DIP switches with 8255 and display the reading on LEDs: 1. Port A address = 8000H 2. Port B address = 8001H 3. Port C upper address = 8002H 4. Mode 0 control word to configure: Port A and Port CU as output = 83H Port B and Port CL as input 5. Write a program: MVI A, 83H STA 8003H LDA 8001H STA 8000H LDA 8002H ANI 0FH RLC RLC RLC RLC STA 8002H HLT

Uploaded by

Sunil Acharya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Interfacing with Peripherals

Topics to be covered Definitions

• Timer IC 8253/54 • The primary function of the


microprocessor is to accept data
• Serial I/O 8251 from input devices, execute
• Parallel I/O 8255 instructions (in the form of
• A/D Converters program), and send results to
• D/A Converter output devices.
• Peripherals are the input and
• Arithmetic Coprocessors output (I/O) devices external to
• System level interfacing the microprocessor.
design • Designing logic circuits and
writing instructions to enable
microprocessor to communicate
with these peripherals is called
interfacing 1
8255: Programmable Peripheral Interface

2
Description of 8255

A1 A0 Selected
0 0 0 Port A
0 0 1 Port B
0 1 0 Port C
0 1 1 Control register
1 X X Chip is not selected
3
Procedure of Interfacing
Hardware connection Steps
8085 8255 To communicate with 8255,
three steps are required
1. Determine the addresses of
Ports A, B, C and Control
Register according to chip
Decoded select logic and address lines
address A0 and A1
2. Write a control word in the
A0 A0 control register
A1 A1 3. Write instructions to
communicate with
peripherals through port A,
B, C

4
5
Modes of Operation
I/O Modes Bit Set/Reset Mode
• Mode 0: All ports function as simple • The BSR mode is used
I/O ports to set or reset the
• Mode 1: This is a handshake mode in bits in Port C
which six bits of Port C act as according to the
handshake signals. Two types of I/O control word written
data transfer; status check and in the control
interrupt; can be implemented. register.
• Mode 2: Port A can be set up for
bidirectional data transfer using
handshake signals from Port C and
port B can be set up either in Mode 0
or Mode 1.
6
7
8
Example : Mode 0: Identify control word
Identify Mode 0 control word to configure port A
and port CU as output ports and port B and port CL
as input ports.
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 1 1
I/O Port A in Mode 0 Port A = Port CU = Port B in Port B = Port CL =
function Output Output Mode 0 Input Input

= 83H

9
Example : BSR Mode : Identify control word

Identify BSR control word to set/reset bits PC7


and PC3.
D7 D6 D5 D4 D3 D2 D1 D0
To set
0 0 0 0 1 1 1 1 = 0F
PC7
To reset
0 0 0 0 1 1 1 0 = 0E
PC7
To set
0 0 0 0 0 1 1 1 = 07
PC3
To reset
0 0 0 0 0 1 1 0 = 06
PC3
10
STB: Strobe input;
generated by a
peripheral device to
indicate that it has
sent a byte data
IBF: Input buffer full;
Acknowledgement by
the 8255A to indicate
that the input latch has
received the data byte
INTR: Interrupt
Request; an output
signal that may be
used to interrupt the
microprocessor. This
signal is generated if
STB, IBF and INTE are
all logic 1

Mode 1: Input with Handshake


11
OBF: Output Buffer
Full; goes low when
MPU writes a byte
into the output latch
of the 8255
ACK: Acknowledge;
input signal from
peripheral when it
receives the data from
8255
INTR: Interrupt
request; may be used
to interrupt MPU; it is
set when OBE, ACK
and INTE are all logic
1

12
Example: Determine control word to set up
port A as input and port B as output in Mode 1

D7 D6 D5 D4 D3 D2 D1 D0
1 0 1 1 0 1 0 0
I/O Port A in Mode Port A PC6,7 Port B Port B Don’t
mode 1 as as in as care
input don’t mode output
care 1

= B4 H

13
Mode 2: Bidirectional Data Transfer
• This mode is used primarily in applications
such as data transfer between two computers.
• In this mode port A can be configured as
bidirectional port and port B either in Mode 0
or Mode 1
• Port A uses five signals from port C as
handshake signals for data transfer. The
remaining three signals from port C can be
used as simple I/O or as handshake for port B

14
Example: Mode 2 operation

15
Example: BSR Mode: Writing subroutine
Write a subroutine to set bits PC7 and PC3 and reset them after
10 ms (delay SR is available); control register address is 83H

BSR: MVI A, 0FH; load accumulator to set PC7


OUT 83H; Set PC7 = 1
MVI A, 07H; load accumulator to set PC3
OUT 83H; set PC3 = 1
CALL DELAY; Insert 10 ms delay
MVI A, 06H; load accumulator to reset PC3
OUT 83H; Reset PC3
MVI A, 0EH; load accumulator to reset PC7
OUT 83H; Reset PC7
RET

16
Example: Chip Select Logic

17
18
1. Identify port address
2. Identify the Mode0 CW
to configure port A and
port CU as output ports
and port B and port CL
as input port
3. Write a program to
read the DIP switches
and display reading

19
20
Program

MVI A, 83H; load accumulator with CW


STA 8003H; write CW in the CR to initialize
LDA 8001H; read switched at port B
STA 8000H; display the reading at port A
LDA 8002H; Read switches at port C
ANI 0FH; Mast upper four bits
RLC; Shift left
RLC;
RLC;
RLC;
STA 8002H; Display at port CU
HLT

21

You might also like