8255 parallel port interface
TRANSCRIPT
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
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
Interfacing the 8255
808820
A19A18A17A16A15A14A13A11A10A9A8
AD7AD6AD5AD4AD3AD1AD0
+ Address and Data lines are multiplexed in the 8088
Address Only
Address/Data
Address and Data Buses
808820
AddressLatch
20-bit address bus
Data Transceiver
8
8-bit data bus
ALE
ALE is Address Latch Enable
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
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
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
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
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
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.
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
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.
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).