So for those of us who haven't had the (mis)fortune to deal with the 8255,
what's so terrible about it?
The minor annoyuance is that you can't individually control the
dirction of the port lines. You can set port A, port B, and each half of
port C to be input or output (at least in the simplest no-handshake mode).
The major problem is that any write ot the mode cotnrol register clears
all output lines to zero. This is ridiculous. Fristly it prevents you
from changing the driection fo a port after
inintialisation in most
cases. But worst than that it ven makes the intial setup of
the system hard.
At the time it was made, the most likely thing to drive from a noutptu
port line was a TTL input. And as is well-known, TTL input float high,
anf ae much easier to pul lhig htan to pull low. After a reset, all ports
o nthe 8255 wwre set to be inputs, so were effectively flating. They
could be trivially puleld up with a resistor if necessary.
So after a reset, the TTL device driven by the 825 sees a l=high elve on
its input. As soon as you write ot the mode register, that becomes a low.
You can then set the lien how you like, but that low state has to extist,
maybe only for a brief period. But your hardware hs to be able to handle it.
On a more resonaly parallel prot IC, one where writign to a mode register
does nto clear the outptu data registers, you can write 1's to output
data registers (even when the lines are set to be inputs), then set the
lines to be outputs. The external device will ways see ahigh level
(firstly from the floating 'input port' and/or a pullup resistor, then
from the 1 on the output port. There will be no
intermediate 0 state. So
the extrnal hardware cna be designed to have active low
inputs, and there
will be no glitches to worry it as the parallel port IC is set up.
Btu alas that doesn't work with the 8255.
The 8255 is proablay OK fror reading switches/keyboards and driving
LEDs/displays, but a right pain to use for anything remotely complicated.
What I want to know is why clearing the data registers upon writing to
the mode register was regarded as a desirable thign to do. I cna think of
no useful applciaiton for this
-tony