<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 27 Aug 1999 23:16:18 +0100
From   : Stuart William McConnachie <stuart@...>
Subject: PS/2 Mouse on the BBC

In message <19990825200638.A14581@...>, Tom Lees
<tom@...> writes
>The newest BeebEm for Windows does emulate the AMX mouse, so you might take
>a peek at it (look in uservia.cpp and uservia.h). From a fairly cursory
>examination, it looks like it works like this:-
>
>The AMX mouse has three buttons. The button states are represented as a
>0 bit for pressed, 1 for not pressed. The button states are in the top
>three bits of the user port data (User VIA port B).
>
>Bit 0 is for X movement. If bit 0 is set, X movement is positive. Unset,
>negative movement. X movement is indicated by the CB1 interrupt line.
>
>Similarly for Y movement with bit 1 and the CB2 interrupt line.
Thanks for the details, which helped a lot.  Also thanks to Chris
Richardson for supplying his AMX mouse for me to dissect and examine the
internal hardware.

I have now successfully butchered a PC PS/2 mouse and connected it up to
my BBC, and I am pleased to be able to report to you all...

        ***** IT WORKS !!!!! *****


For anyone who's interested in building a BBC mouse for themselves there
are brief details of what to do below.  I plan to produce some more
detailed documentation (with pictures, circuit diagrams, etc.) in the
near future and post them at 8BS:

http://chroma.media.keele.ac.uk/8bs/

I must stress that you should only attempt this procedure if you have
experience with electronics and soldering.  Even if you are experienced
you do so ENTIRELY AT YOUR OWN RISK.

You will need the following parts:
        1 x Old PS/2 mouse (3 buttons preferable)
        1 x 74LS14N Hex Schmitt Inverter
        1 x 14 pin DIL IC socket for mounting above IC
        1 x 20 pin DIL IDC header plug for connection to user port
        1 x Small piece of vero board (7 x 7 holes!)
        1 x 9 core miniature cable (length as required, 2m is ample)

Excluding the mouse, the above parts cost me just £3.70.
        
1) Open up the mouse, usually by removing the screws in the base.
Remove the main PCB from inside the mouse.

2) Remove the IC which is soldered to the mouse PCB.  This IC is no
longer required for the BBC, so you can remove it by cutting each of the
pins with a knife (or cutters) and then unsolder the cut pins (which is
a lot easier than trying to remove the IC intact).

3) You will need to remove the existing mouse cable and replace it with
the 9-core cable, as the BBC mouse requires more connections than the
PC.  Before doing this, by examining the layout of the PCB and the
connections to the PS/2 mouse port it should be possible to deduce the
0v and +5v lines on the mouse PCB.

4) Cut the vero tracks down the middle of the board and mount the DIL IC
socket centrally on the vero board.  Solder into place.

5) Using some thin insulated wire (I cut a short length from the 9 core
cable and used the individual coloured strands from inside) connect the
ground and Vcc pins of the 74LS14 from the vero board back to the mouse
PCB.  If you have carefully removed the IC from the board you should be
able to find some free pads with the appropriate supply voltages.  Make
sure you have sufficient cable to be able to locate the small piece of
vero with the 74LS14 on it somewhere within the mouse case.

6) Also, on the mouse PCB, follow the tracks from the optical
transducers back to the pads of the old IC.  Connect these pads (there
should be 4 of them: 2 up/down and 2 left/right) to the INPUTS of 4 of
the 74LS14 inverters.  Note you should also make sure that the inputs of
the remaining 2 inverters are connected to a signal or supply line and
not left "floating".

7) Using your new piece of cable connect two of the wires (I used Black
and Red) to the 0v and +5v on the mouse PCB.  In fact I was actually
able to reuse the miniature connector from the mouse end of the original
PC PS/2 cable for these two signals onto the PCB.  Most mouse PCBs will
probably have a supply smoothing RC network, which will be reused if you
do things this way.

8) Connect 4 more wires from the new cable to the outputs of the 4
74LS14 inverters you connected in step 6.  Again make sure you have
sufficient cable to be able to locate the small piece of vero with the
74LS14 on it somewhere within the mouse case.

9) Connect the remaining 3 wires to the outputs of the 3 mouse switches
on the mouse PCB.  In the original PCB circuit these will have been
connected back to some of the pads of the removed IC, so there would be
an ideal connecting point.  IMPORTANT: On the mouse I used, when a
switch was pressed, this connected the appropriate pin of the IC to +5v.
A BBC AMX mouse works by connecting a pin on the user port to 0v when a
button is pressed.  (i.e. inverted logic).  Examine the layout of the
tracks on your mouse PC carefully to determine which polarity your
switches connect to.  If, like mine, they connect to +5v, you will need
to make a small modification to the PCB by cutting the 5v line that
supplies the switches and connecting the CUT-OFF PART of the circuit
(inputs to the switches) to 0v instead.  IN DOING SO MAKE SURE THAT YOU
DON'T CREATE A SHORT BETWEEN THE 0v AND +5v LINES!!!!!

10) You are now in a position to connect the IDC header to the other end
of your cable.  With care you can push each of the wires individually
into the correct connector.  I used a small pair of tweezers for this,
but remember to ask your girlfriend/wife first!  Make all of the
connections shown below, EXCEPT pin 1 (+5v):

Looking at the back of the IDC plug and into the user port with the
locating notch at the top:
                   _____
 _________________|     |___________________
|                                           |
|    19  17  15  13  11  9   7   5   3   1  |
|                                           |
|  20  18  16  14  12  10  8   6   4   2    |
|___________________________________________|

PIN     SIGNAL
 1      5v on mouse PCB
 2      HORIZONTAL "Move" signal
 4      VERTICAL "Move" signal
 5      0v on mouse PCB
 6      HORIZONTAL "Direction" signal
10      VERTICAL "Direction" signal
16      Left button output
18      Middle button output
20      Right button output
Others  N/C

Pins 2 & 6 and 4 & 10 are the difficult ones to connect correctly.
These are connected to the outputs from the 74LS14 schmitt inverters.
The HORIZONTAL signals are derived from the optical sensor on the wheel
that rotates when the mouse is moved left/right.  The VERTICAL signals
from the sensor on the wheel that rotates when the mouse is moved
up/down.  Get horizontal and vertical the wrong way round and your mouse
will behave very strangely!

To decide which signal is "Move" and which "Direction" requires you
to.... guess!  (If you get it wrong then all that will happen is that
moving the mouse up will cause the pointer on the screen to move down!
A similar mistake can be made in the horizontal direction.)

11) You are now ready to connect up the mouse to a BBC.  Reassemble the
mouse (remember to replace the ball!) taking care that the 74LS14 is
safely secured within the case and that all wires are kept well away
from any moving parts.  Connect the IDC plug to the user port of the BBC
and connect an ammeter between pin 1 of the user port and the (as yet)
unconnected +5v wire.  If it draws much more than 50mA, then DISCONNECT
THE POWER IMMEDIATELY and find the fault or short in your circuit!  When
all is well then permanently connect the 5v line as per above.

12) Launch some mouse driven software on the BBC (e.g. AMX art) and test
the mouse buttons and direction of movement.  If the pointer moves the
wrong way in one (or possibly both) axis, then simply reverse the
connection of pins 2 & 6 (Horizontal) or 4 & 10 (Vertical) depending on
the axis which is incorrect.

13) Once testing is finished you can complete the assembly of the IDC
header plug by fitting the cable strain relief.  I finished off by
wrapping the plug and cable with insulating tape, just to tidy the lose
wires and provide a little extra security for the cable (ideally I
wouldn't have used an IDC connector, but Maplin don't stock a connector
of this type for standard cable).


If you have any questions about the above, then please do not hesitate
to contact me!

If however you totally destroy your PC, BBC or mouse (or any combination
of these) either due to your own mistakes, or unintentional errors or
omissions in the above directions, then please cry quietly in the corner
and don't complain to or blame me.

Regards, and enjoy!
-- 
Stuart McConnachie (stuart@...              )
43 The Hollows, Long Eaton, Nottingham, NG10 2ES, UK
Mobile: 0966 224307
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>