Chapter 6a PDF
Chapter 6a PDF
1 2 3
4 5 6
1
24-Sep-20
7 8 9
cs
10 11 12
2
24-Sep-20
These are bidirectional, tri-state data bus lines are connected to the system data bus. They A0-A1 The selection of input port and control word register is done by using A0 and A1 pins In
are used to transfer data and control word from microprocessor (8085) to 8255 or receive These are 8 bit bidirectional I/O pins divided into two groups PCL (PC3-PC) and PCU (PC7-
conjunction with RD and WR pins.
D0-D7 (Data Bus) data or status word from 8255 to the 8085. PC4).these groups can individually transfer data in or out when programmed for simple I/O,
PC0-PC7 and used as handshake signals when programmed for handshake or
(Port C) bidirectional modes. A1 A0 RD WR CS Operations
These are 8 Bit bidirectional I/O pins used to send data to output device and to receive data 1 0 1 0 0 DATA BUS TO PORT C
from input device. It functions as an 8 Bit data output latch/buffer when used in output This pin can be enabled for data transfer operation between the CPU and 8255.
PB0-PB7 (Port B) mode and as an 8 Bit data input latch/buffer when used in input mode. CS 1 1 1 0 0 DATA BUS TO CONTROL REGISTER
13 14 15
16 17 18
3
24-Sep-20
PORT B
• Port A can be used for bidirectional handshake data 1=I/P, 0=O/P
transfer. This means that data can be input or output on MODE SELECTION
0 = MODE 0
19 20 21
DON’T CARE
BIT SELECT
0 1 2 3 4 5 6 7
0 1 0 1 0 1 0 1 B0
0 0 1 1 0 0 1 1 B1
0 0 0 0 1 1 1 1 B2
22 23 24
4
24-Sep-20
1 0 0 1 1 0 0 0
= 98H 1 0 1 0 1 1 1 0
= AEH
Program: Program:
MVI A,98H ; LOAD CONTROL WORD MVI A,AEH ; LOAD CONTROL WORD
OUT 83H ; SEND CONTROL WORD OUT 23H ; SEND CONTROL WORD
25 26 27
Find the control word for the register arrangement Find the control word for the register arrangement 82C55A Programmable Peripheral
of the ports of intel 8255 for mode 0 operation. of the ports of intel 8255 for mode 0 operation. Interface (cont.)
• Port A: Output, Port B: Output, • Port A: Input, Port B: Input,
• Port CU: Output, Port CL: Output • Port CU: Input, Port CL: Input EXAMPLE:
What is the addresses of port A, port B, port C
of the 82C55A device?
Solution: Solution: Solution:
To access port A, A1 A0 = 00, A15 = A = 1, A =
14 13
8255 is 80H. 8255 is 9BH. and the address of the control register is C003 . 16
28 29 30
5
24-Sep-20
0 0 0 C0
0 0 1 C1
0 1 0 C2
Mode select
0 - Mode 0 0 1 1 C3
1 – Mode 1
1 0 0 C4
PORT C (UPPER) 1 0 1 C5
1- Input
0- Output
1 1 0 C6 Mode 0 port pin functions
1 1 1 C7
31 32 33
34 35 36
6
24-Sep-20
37 38 39
40 41 42
7
24-Sep-20
43 44 45
46 47 48
8
24-Sep-20
49 50 51
52 53 54
9
24-Sep-20
55 56 57
58 59 60
10
24-Sep-20
Solution: of the previous figure so that port A is an output Since PPI 0 is memory mapped, the following
We begin by converting the address to binary port, ports B and C are input ports, and all three move instructions can be used to initialized the
form. This gives ports are configured for mode 0 operation. control register:
A 19
…A A
1 0 = 000000000100000000102 Solution: MOV AX, 0 ; Create data segment at
In this address, bits A 10= 1 and A 0= 0. 00000H
The control byte required to provide this
Therefore, the 74F138 address decoder is MOV DS, AX
enabled whenever IO/M = 0. configuration is:
MOV AL, 8BH ; Load AL with control byte
A 5A 4A 3 = 000
MOV [406H], AL ; Write control byte to PPI 0
This input code switches decoder output O to 0 control register
logic 0 and chip selects PPI 0 for operation.
The address bits applied to the port select inputs
of the PPI are A 2A1 = 01. These inputs cause port
B to be accessed. Thus, the address 0040216
selects port B on PPI 0 for memory-map I/O.
61 62 63
Memory-Mapped Input/Output
Ports
EXAMPLE:
Assume that PPI 0 in the previous figure is configured
as described in the previous example. Write a program
that will input the contents of ports B and C, AND
them together, and output the results to port A.
Solution:
The addresses of the three I/O ports on PPI 0 are:
Port A = 00400 16Port B = 00402 16Port C = 00404 16
Now we set up a data segment at 00000 16and the
program is:
AND AX, 0 ; Create data segment at 00000H
MOV DS, AX
MOV BL, [402H] ; Read port B
MOV AL, [404H] ; Read port C
AND AL, BL ; AND data at port B and C
MOV [400H], AL ; Write to port A
64
11