8255 parallel port interface

13
8255 PPI (Programmable Peripheral Interface) (Parallel Port Interface) 8 8 4 4 Port A Port B CH CL { Por t C 8 Dat a WR RD CS RESET A1 A0

Upload: abhishek-thakur

Post on 07-Apr-2015

362 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: 8255 Parallel Port Interface

8255 PPI(Programmable Peripheral Interface)

(Parallel Port Interface)

8

8

4

4

Port A

Port B

CH

CL{Port

C

8Data

WR

RD

CS

RESET

A1A0

Page 2: 8255 Parallel Port Interface

Addressing the 8255

A1 A0 = 00 Port A ; IN, OUT 8 bits at a time

= 01 Port B ; IN, OUT 8 bits at a time

= 10 Port C ; IN, OUT 8 bits at a time

= 11 Control Register; Write ONLY!

From IO.EQU PORT2A = 0224h ;Port A externally available PORT2B = 0225h ;Port B externally available PORT2C = 0226h ;Port C externally available STAT2 = 0227h ;8255-5 # 2A / Status Register

Page 3: 8255 Parallel Port Interface

Interfacing the 8255

808820

A19A18A17A16A15A14A13A11A10A9A8

AD7AD6AD5AD4AD3AD1AD0

+ Address and Data lines are multiplexed in the 8088

Address Only

Address/Data

Page 4: 8255 Parallel Port Interface

Address and Data Buses

808820

AddressLatch

20-bit address bus

Data Transceiver

8

8-bit data bus

ALE

ALE is Address Latch Enable

Page 5: 8255 Parallel Port Interface

Addressing the 8255

20-bit address bus

8-bit data bus 8

8

4

4

Port A

Port B

CH

CL{Port

C

Data

WR

RD

CS

RESET

A1A0

A0A1

LogicCircuit

A15-A2

IO/M

Page 6: 8255 Parallel Port Interface

Logic Circuit• Inputs to the Logic Circuit

– address lines A15 - A2(the I/0 address space is 216 addresses, and A1 and A0 are used for the chip’s address lines)

– the 8088’s IO/M lineHIGH denotes an IO instruction (IN, OUT)LOW denotes a memory access instruction (i.e., MOV)

• Output of the logic circuit

– a single low value from the 15 inputs (a NAND or OR gate) to activate the Chip Select

• The connections for A15-A2 fix the chip’s address in I/O space

Page 7: 8255 Parallel Port Interface

8088 pins

The 8088 is a 16-bit microprocessor:

Internal registers and buses are 16 bits wide

8 address/data lines

12 addresslines

IO/M

RD and WR

Page 8: 8255 Parallel Port Interface

Minimum mode

• In minimum mode, the 8088 is the only microprocessor in the circuit. It can assume that it has control of memory, address, and data buses

• In maximum mode, the 8088 is configured for multiple microprocessors. The function of pins is changed to provide processor-to-processor communication

Page 9: 8255 Parallel Port Interface

8255 PPI(Programmable Peripheral Interface)

(Parallel Port Interface)

8

8

4

4

Port A

Port B

CH

CL{Port

C

8Data

WR

RD

CS

RESET

A1A0

Page 10: 8255 Parallel Port Interface

Reset

• A single reset line is connected to all chips in the system (8088, 8255, 8253, etc.)

• Reset puts the chip in a known state

• Pushing the reset button on your computer generally activates a 555 timer circuit that outputs a high pulse for a short period of time

• On Reset, the 8088 goes to fixed addresses (ROM chips) where boot sequence instructions are stored.

Page 11: 8255 Parallel Port Interface

A/D

• Step 1: Call SetupAD

• Step 2: Mov al, channel#Mov dx, WRTCH1Out dx, al

• Step 3: Mov dx, STBAD1Out dx, al ; or IN dx, al

• Step 4: Mov CX, delaycountL1: Loop L1

• Step 5: Mov dx, RDCH1IN al, dx

Page 12: 8255 Parallel Port Interface

A/D #2• After an A/D value is read, many algorithms will need to

compare the analog voltage to some target analog voltage

• For the computers in Anderson 307, the conversion is 18 mv per 1-bit change.

• If Vtarget is the target voltage in volts, it must be converted to a target count

Multiply Vtarget * 1000 ; target in millivoltsDivide target by 18 ; equivalent count

• Careful use of word-wide vs. byte-wide multiply and divide is essential

• For critical applications may need to investigate remainder to round count to nearest integer.

Page 13: 8255 Parallel Port Interface

D/A• A voltage proportional to the count appears on the D/A

output Mov dx, DAC#Mov al, dacountOut dx,al

• At times the program must make a voltage-to-count conversion (previous slide).