[Coco] Arduino as a Mouse/Keyboard interface?

Phill Harvey-Smith afra at aurigae.demon.co.uk
Mon Jul 2 14:45:54 EDT 2012


On 02/07/2012 17:32, Andrew wrote:
>> Rather than hooking the AVR's I/O lines directly to the 6821, a better
>> IMHO way of doing it is to have a crosspoint switch in between such as
>> the MT8816, the AVR translates the PS/2 (or USB) scancode into a
>> row/column, and turns on or off the switch (within the crosspoint) that
>> corisponds to the CoCo key you want to press. The output from the
>> crosspoint matrix is connected to the CoCo keyboard port.
>
> IYO, why would this be better than direct control by the ATMega
> (assuming the pins were available, and direct port addressing was used)?
> I could see using a buffer or such in between the parts, and such a
> switch would take care of that aspect.

Because of speed, and different methods of scanning the keyboard.

Basically the CoCo (ROM) scanning routine does this :
1. Store column to scan in PIA col
2. Read PIA rows
3. shift to next column, if all done exit
4. goto 1

Now this means that in between the CoCo storing the coulmn to scan and 
then reading it a few instructions later the AVR has to work out which 
column is being scanned and output it's data on a port, now some of the 
ATMegas can be clocked at 20MHz so *MAY* keep up with this.

Also what happens when some program e.g. a game decides to drive mutiple 
columns low to just test if a key is pressed ? This will cirtainly 
confuse whatever code was on the AVR.

The crosspoint switch because it is an array of switches, just switched 
on and off by the AVR instead of directly pressing them will work 
exactly as the real keyboard does.

You may also be able to do this with a collection of latches or a CPLD / 
FPGA. But I suspect that you are going to need some circuitry between 
the AVR and the CoCo.

I am willing of course to be prooved wrong :)

Of course if you where going to write driver software for the CoCo side 
then there would be no problem, however this would of course break 
backward compatibility.

Cheers.

Phill.

-- 
Phill Harvey-Smith, Programmer, Hardware hacker, and general eccentric !

"You can twist perceptions, but reality won't budge" -- Rush.





More information about the Coco mailing list