6522 weirdity

From: pete_at_dunnington.u-net.com <(pete_at_dunnington.u-net.com)>
Date: Mon Dec 30 13:13:00 2002

On Dec 30, 10:30, Sellam Ismail wrote:
>
> Ok, I've kinda figured out the control lines on the 6522.
>
> First of all, I've got them triggering a flag in the IFR whenever there
> is a state change on any control pin from a ground to either floating or
> +5V.
>
> For example, CB1 is plugged into ground. I reset the IFR (so no flags
> are set). I remove the ground from CB1. CB1's flag in the IFR gets set.
> I reset that flag. If I plug CB1 into +5V, I get no flag. If I unplug
> CB1 from +5V, I get no flag. If I plug CB1 back into ground, I get a
> flag.

You're sensing noise. The inputs are not level-sensitive, they're
edge-triggered. If you have the PCR set to zero (which is the default
after a reset), CB1's flag will set whenever CB1 sees a falling edge.
 You're probably generating small noise spikes when you remove the ground
(this is a bit like key bounce) or picking up stray current (the inside of
an Apple is a pretty noisy place, electrically speaking). This would
explain why the flag gets set when you initially remove the ground from
CB1, and then again when you ground it again. Without the noise, it
wouldn't set the flag when you remove the ground, only when you restore it.

> Why are the flags being set only when one of the control lines no longer
> senses ground? I tried playing with the PCR to see if setting whether
the
> control pins are active positive edge or active negative edge changes
this
> behavior but it doesn't.

Actually it does, but I bet you've not got pullups or pulldowns on the
pins, and you're seeing noise. These pins are fairly high impedance. And
because the inputs are edge-sensitive, the flag gets set not just because
it's low (otherwise it would get set if it were low when you configure it,
and you'd not be able to clear the flag) but because it *changes state* to
become low.

> I can work with this the way it is: I'm
> basically tracking state changes on the control pins, which is fine for
> my purposes since the reader will go from TTL false to TTL true if there
> is an error, and back to TTL false when the error gets cleared. But I
> want to know how the behavior of the control lines is set.

See my post from a few minutes ago.

> Now, I seem to have a problem with CA1. If I have CA1 connected to
> ground, it's stable. As soon as I remove it from ground and it's
> floating, CA1's state starts to fluctuate wildly for a little over 2
> seconds. It's flag in the IFR keeps triggering over and over. If, right
> after I remove it from ground and it starts fluctuation, I plug it back
> into ground, it stabalizes (it stops changing states). As soon as I
> remove it again, it fluctuates wildly.

Noise. Floating inputs are A Bad Thing.

> Is CA1 tied to one of the 16-bit timers? It sure seems like it. The
docs
> say something about being able to make one of the control lines trigger
> off a timer. Am I triggering the shift register somehow?
>
> What in tarnations is going on?

Did I mention noise? :-)

-- 
Pete						Peter Turnbull
						Network Manager
						University of York
Received on Mon Dec 30 2002 - 13:13:00 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:34:42 BST