Play Meter

Issue: 1979 December 31 - Vol 5 Num 24

PIA troubleshooting
made easy
If you have had the experience of
trouble -shooting an electronic pin
CPU board , you have probably
encountered the 6821 l.C . This is
Motorola's
Peripheral
Interface
Adapter , or PIA . (Note : some earlier
PIA's were numbered 6820 ; their
operation is identical.) This formid -
able -sounding piece of jargon means
that this component is used to
connect various devices (peripherals)
to the MPU .
Figure 1 shows a pinout diagram
of the PIA . Do not despair over the
many wires emanating from it ; if you
have been following this series , you
know many of them already .
Basically, they break down to the
MPU side and the peripheral side .
The processor communicates with
the PIA over the bi -directional data
lines DO-D7 in a manner identical to
any other clock connected to the
Enable input.
There are also three Chip Selects ;
two active high , the other active low .
All must be in the appropriate state ,
or the PIA will remain deaf and
dumb . The two Reqister Select inputs
connect to AO and A 1 of the Address
Bus . These provide a means for the
MPU to read and write to the several
registers hidden inside the chip .
Finally, there are two Interrupt
Request outputs (active low). These
are usually tied together and pulled
up with a resistor to + 5V. When
either one goes low , the IRQ input of
the MPU is activated . This forces the
MPU to stop what it was doing and
"service" the PIA - which usually
amounts to reading data from it.
Debugging this side of the PIA is
like debugging RAM (read / write
memory) . You have to check for
shorts , opens, chip selects that do
not happen (or are stuck on),
through whatever means you have .
Note : the system 's self-test , if it has
one . can be helpful here.
However , faults on the busses will
make the system crazy and unable to
execute a self-test routine . You may
want to wire in a NOP test circuit in
order to force the processor to cycle
through all of its addresses. In this
state, you should see pulses on all
the chip selects as their particular
addresses fly by .
The uniqueness of the 6821 is on
the peripheral side . The twenty lines
break down into two separate and
independent sections , A and B; each
section has two "control" lines and
eight "peripheral" lines.
Have you noticed that I have
avoided referring to the peripheral
side lines as inputs or outputs? This is
because the function of these lines is
determined by the circuit designer .
Each of the PA and PB lines can
be set as either an input or an output.
The CA2 and CB2 lines are also
programmable as inputs or outputs .
Only the CAl and CBl lines are
fixed as inputs . The configuration of
the 6821 is done by the processor by
writing into the hidden registers
mentioned earlier . This is generally
done once at power-up . Subse-
quently , the processor limits itself to
reading and writing the data registers
of the PIA.
When a PA- or PB line is
configured as an output , it acts like a
latch , i.e ., it retains the bit pattern
stored in it until the MPU rewrites it.
As an input , it acts like a "window"
on whatever is connected to it . The
"window" is "open " only when the
MPU reads the address of the data
register inside the PIA . At any other
time, the outside world is locked out
and does not affect the MPU .
The CAl and CBl lines are
different. When the MPU enables
them - by storing a certain bit pattern
inside the PIA - they act as triggers
for the IRQA and IRQB outputs,
respectively . These outputs interrupt
the normal program flow , and are
used to either sync the MPU to
something (such as a display refresh
timer) or to indicate that something
happened which requires immediate
attention .
The CA2 and CB2 lines differ in
subtle ways which are not important
here . Basically , though , they can be
used either to "acknowledge" and
interrupt , by pulsing , or , more
commonly, to act as additional
latching output bits .
Engineers like the 6821 because it
makes it easy to interface a wide
variety of devices to the processor.
All of the messy latching and
bi -directional buffering is taken care
of. It also reduces the parts count.
Nice for the engineers , 'you say ,
but what about the tech repairing
these boards? You do not have
access to the program , so you do not
even know how the device is
supposed to act. Fortunately , there
are ways around this situation . As
usual. the best repairmen are the
ones who can get the most out of the
least information .
The first step is to study the
schematic to find out which lines are
outputs and which are inputs .
Obviously , lines going to th~ inputs
of I. C.'s or to transistor bases are
outputs . The ones going to the I.C.
inputs should have a healthy TTL
voltage swing; those feeding transis-
tors may not necessarily be near
+ 5V or ground ; this is because
transistors are driven by current flow
rather than voltage changes .
Lines connecting to switches may
be inputs : however. be careful. The
designer may be "scanning" the
switches with pulsed outputs and
sensing them elsewhere. If you have
a known good board , you are ahead
of the game , because you can
observe what is going on.
The CA and CB lines can be
tricky . As mentioned below , the CAl
and CBl lines are inputs used to
generate interrupts to the processor .
They are edge -triggered, like a
flip -flop ; but which edge is active is
another one of the variables under
the designer's control. When the
edge happens , the IRQ line is pulled
low until the processor unhooks it by
reading the PIA .
However . the program can
"mask" the effect of the CA and CB
lines , so do not jump to conclusions
yet - check a good board if you see
transitions on these inputs with no
IRQ output .
Also , if there is a short or very low
resistance path to + 5 on the IRQ
line , the PIA (and any other chip)
would not have the stuff to pull it
down . So check for shorts if IRQ is
stuck high . If it is stuck low , you can
have either a short, or a processor
which is too confused to clear its
interrupts .
Start by depressing the reset
switch , or grounding the processor's
reset input. This should raise the IRQ ·
if the problem is not a short (or a
dead device on the line) . If IRQ
remains stuck , disconnect the PIA
IRQ outputs from the rest of the
string and try the reset again . If this
does not cause it to come up , you
have got a bad PIA (or , you also
disconnected its pull up resistor) .
Remember, anything that is tied to
an IRQ line has to have a resistor to
+ 5, or else it will never show a high .
Figure 2 shows some typical input
and output circuits to get you started
on your detective work . The " Box"
discusses a common application of
the PIA - scanning a switch matrix .
As you can see. the 6821 has a lot of
legs . but it is basically friendly .
Reprinted with permission of Star-
Tech Journal. Merchantville , New
Jersey
•S
l
f"l~.l.
r
DO
Ol.
SecT~<»~' A.
INf'IJFPVT
DZ.
~D~
I
--.jD't
D.)
O UTPUT cONN EC.IIONS
r/J.---,
' > 0 - - - CI P'AO
ACfiVE:- H16ti 5WITOt
fVATRIX ~TROBe
Df ~ W\1
EE ,AB5£NT-
WILL NOT f<:E}CH 15v
U/'llE5S R 1.:; U5t:D
®of
'
i
6821
f'A~
!
~
I
i
I
i
I
;_____j
Fl • 2..
RO
'Z2K
SWITCH
M!IT~.IX
RETURN
-
I
I ' h!
INPUT COtJ tJECIIONS
r--,
I;/
L
--
I
j-J_
-
Dlf'-5Wif01
TYPICAL CONtJ£CTION5>
5E:N5£

Download Page 4: PDF File | Image

Download Page 5 PDF File | Image

Future scanning projects are planned by the International Arcade Museum Library (IAML).

Pro Tip: You can flip pages on the issue easily by using the left and right arrow keys on your keyboard.