[comp.sys.amiga] Amiga Mouse info needed

rlcarr@athena.mit.edu (Rich Carreiro) (11/04/88)

Hello,

I am currently enrolled in a digital design class.  My lab partner and
I are going to attempt to build a life machine.  As an input device, we would
like to use an Amiga mouse (since I happen to have an extra one).  Among
other things, we are going to have to build some hardware to read the mouse.
Can someone mail me info on:

(a) The MOUSE (i.e. NOT the connector on the side of the computer) pinouts

(b) Explain the output format, i.e. in what form are the horiz and vertical
    signals, and what the h*** is horiz and vertical quadrature?

(c) If anyone has ever built a mouse interface like this before, tips
    and pointers would be welcome.

I (and my partner) will be eternally grateful for any information we get
(after all, you wouldn't want us to use a Mac mouse 8-)

ARPA:    rlcarr@athena.mit.edu
UUCP:    {wherever}!mit-eddie!mit-athena!rlcarr
BITNET:  rlcarr%athena.mit.edu@MITVMA.mit.edu

*******************************************************************************
* Rich Carreiro                 "MIT isn't Hell.  It's where you go when      *
* rlcarr@athena.mit.edu          you've been bad in Hell." - Anon.            *
*******************************************************************************

brianm@sco.COM (Brian Moffet) (11/08/88)

In article <7804@bloom-beacon.MIT.EDU> rlcarr@athena.mit.edu (Rich Carreiro) writes:
>I (and my partner) will be eternally grateful for any information we get
>(after all, you wouldn't want us to use a Mac mouse 8-)
>

Actually, a little while ago, I took my amiga mouse apart and
went at it with some simple electronics equipment.  I guess
that is what you get when you get board of programing :-)

Anyway, I found that the amiga mouse is what is called an
opto-mechanical mouse.  What this means is that when you move
the mouse, it will rotate 2 wheels inside the mouse.  The wheels
have an *odd* number of holes in them.  These holes allow
a small light to shine on a photo-diode and generate a voltage,
+5 I believe, to either the "normal" or "quadrature" pin.

How this works is:   The "normal" pin is volted high, and the
when you continue to move the mouse, the "normal" is dragged low
and the "quadrature" is dragged high.  the electronics in the
machine can now tell which direction the mouse is moving.
for example (I think this is in the positive direction, I am
not at my machine with my notes)

	      _________	     _________      _________
quad	______|       |______|       |______|       |

	_______        _______      _________
normal	|     |________|     |______|       |______

This applies for the vertical and horizontal.  Also, the
amiga mouse will send 2 of 3 mouse buttons  1 & 3.
It does not send a signal for the middle button.

I posted this because I thought more than 1 person might
be interested.   As soon as I get married (* in january *)
perhaps I'll make a public domain track-ball.  That was why
I did this in the first place.

Oh, yes, I have been called a hacker. :-)

brian

-- 
Brian Moffet			{uunet,decvax!microsoft,ucscc}!sco!brianm
 -or-				...sco!alar!brian
"Evil Geniuses for a better tomoorow!"  My fish and company have policies.
					I have opinions.

sgt@dukeac.UUCP (Stephen G. Tell) (11/09/88)

I build somthing to deal with mouse signals once, and I think I remember
it enough to explain how it works.

I don't have a manual handy, so I don't know the pinouts, but if you
have the simple introductory manual, its good enough with a bit of
explaining:
Power & ground are obvious
The amiga supports 3-button mice on the 9-pin plug, The mouse that
comes with it uses button 1 and 3 inputs, (I think)
I've actually got a 3-button mouse on my machine, but haven't fooled around
with software to use the new middle button.

The horizontal (vertical) quadrature pins tell you speed and direction
for the two axes.  I'll speak in terms of horizontal, vertical is
the same.

The two horizontal signals are basicly the same signal; reversing them
changes the apparent left/right direction.  I forget what the manual's
pinout calls them exactly, but it leads you to believe that they
are somehow fundamentaly different.

If you have a dual-trace scope, hook power to the mouse and look at the
two horizontal quadrature signals as you move back and forth, then the
following should become clear:

Either signal alone gives you speed information as a certain number
of pulses per unit distance the mouse is moved.
The relative phase of the two signals tells you what direction
you're moving.

If we call the two signals A and B, they might look like this for
leftward movement:

   ____       _____       _____
A      |_____|     |_____|     |_____
  __       _____       _____       __
B   |_____|     |_____|     |_____|

And like this for rightward movement:
  __       _____       _____
A   |_____|     |_____|     |_____
  _____       _____       _____       __
B      |_____|     |_____|     |_____|

At any transition of any line, look at the other line to tell you
what direction you're going as follows:

	A		B		moving
	rising		high		left
	rising		low		right
	falling		high		right
	falling		low		left

	high		rising		right
	low		rising		left
	high		falling		left
	low		falling		right

How to do this in hardware:
One way that I've seen it done is to generate a short pulse
with a one-shot on both transitions of both lines (4 one shots,
give short high pulses on each of A rising, A falling, B rising, B falling)
and then AND these each of these with the correct one of
A, inverted-A, B or inverted-B as in the table.

Then, Or together each of these 4 pulses for left and 4 for right
and feed that to a counter.

The pulses from the 1-shots have to be shorter than the pulse rate from
the highest rate of movement you expect from the mouse.

There are other ways to do the hardware; someone want to tell us
how the Amiga does it?
-- 
Steve Tell  Student, Duke University; Employee, Duke Tel-Com (summer only)
Former Chief Engineer, Cable 13 / Duke Union Community Television.
sgt@dukeac.ac.duke.edu;  {ihnp4, ulysses, et. al.}!mcnc!ecsgate!dukeac!sgt

ditto@cbmvax.UUCP (Michael "Ford" Ditto) (11/10/88)

In article <1093@dukeac.UUCP> sgt@dukeac.ac.duke.edu (Stephen G. Tell)
writes [ a decent description of how mouse quadrature works ]:
>At any transition of any line, look at the other line to tell you
>what direction you're going as follows:

... but then describes a really icky way of interpreting these signals
in hardware ...

>How to do this in hardware:
>One way that I've seen it done is to generate a short pulse
>with a one-shot on both transitions of both lines (4 one shots,
 [ ... and lots of other awful stuff ... ]

There is a very simple way:  Use one signal as an edge-triggered clock
for an up/down counter, and the other signal is simply the counter's
direction input.  I'm pretty sure that's the way the Amiga does it.

It doesn't matter which signal is which, or whether you count rising
or falling edges, or whether the direction is UP/DOWN* or DOWN/UP*;
changing any of these will simply reverse the counting direction.
-- 
					-=] Ford [=-

"The number of Unix installations	(In Real Life:  Mike Ditto)
has grown to 10, with more expected."	ford@kenobi.cts.com
- The Unix Programmer's Manual,		...!sdcsvax!crash!elgar!ford
  2nd Edition, June, 1972.		ditto@cbmvax.commodore.com