[Coco] PIA keyboard input?

Brett K. Heath hcmth019 at csun.edu
Sun Dec 7 17:48:01 EST 2003


On Sun, 7 Dec 2003, James Dessart wrote:

> I'm trying to figure out how to read the keyboard from the PIA, and
> I've checked out BASIC Unravelled.  What it seems to be is that you
> place a 0 into the bit of the column strobe that you want, and then
> check the rows to see if there are keys depressed in that row.  Is that
> correct?

> So, as I see it, to find out which keys are depressed, I need to roll a
> 0 through the column register, and check the row register.  Depending
> on which I see depressed, I can say which keys are pressed.  Do I have
> a good understanding of this?  Other than the joystick button bit, are
> there any caveats to this?

Someone else may have mentioned this but you need to allow debounce time
after you detect a keypress before you resume scanning. IIRC about 30
milliseconds should do it but 50 would be better and it's a good idea
to verify that the key is still pressed after the debounce time. Allow
the same time after a key release (and verify it also).

You don't want to stop scanning just because a key is down but you need to
think very carefully about how you deal with multiple keys being down
simultaneously (keeping track of which key was pressed first helps with
this).

HTH

Brett K. Heath



More information about the Coco mailing list