Path: utzoo!utgpu!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!rutgers!deimos!ksuvax1!cseg!hcx!gmg From: gmg@hcx.uucp (Greg M. Garner) Newsgroups: comp.sys.amiga.tech Subject: Re: Amiga Mouse info needed Summary: More quadrature... Keywords: Amiga Mouse Info Pinouts Message-ID: <1135@cseg.uucp> Date: 10 Nov 88 06:50:54 GMT References: <7804@bloom-beacon.MIT.EDU> <1093@dukeac.UUCP> Sender: netnews@cseg.uucp Organization: College of Engineering, University of Arkansas, Fayetteville Lines: 96 I sent this Email to the person asking, but it seems that more than one person is interested in how to do this, so here is my two bits on the mouse. Note that these are the pinouts of the amiga and the mouse, as they have the same numbering scheme on the male and female connectors. pin # NAME function 1 FORWARD* Quadrature output back-forward 2 BACK* Quadrature output forward-back 3 LEFT* Quadrature output left-right 4 RIGHT* Quadrature output right-left 5 No connection 6 FIRE0* left mouse button. 7 +5 +5 power into the mouse. 8 GND Ground into the mouse. 9 POT0Y right mouse button. Quadrature outputs look like this: (See page E-14 of hardware man v1.1) LEFT* ___ ___ ___ ___ ___ ___ \___/ \___/ \___/ \___/ \___/ ___ ___ ___ ___ ___ ___ RIGHT* _/ \___/ \___/ \___/ \___/ \___/ As you can see, these are out of phase 90 degrees. The phase angle will change from +90 degrees to -90 degress when then direction the mouse is moving changes from left to right. A neat little circuit to take advantage of this fact is as follows: _________ Q0 out _________ | | | _______ | | LEFT* ----------| D Q |----| \ \ \ | Q |--- Q1 out | | |----| | \_____| | | | |---| | / | D | | Q* | | / /______/ | | |_________| | |_________| | RIGHT* These are edge triggered d flip flops. This circuit acts like a counter which will keep track of the position of the mouse at all times. This particular circuit is only able to count up to 3, then it rolls over to 0 again, (outputs at Q0 and Q1), but it will count up when the mouse is rolling left, and count down when it is rolling right (I may have these reversed). If you want to add more resolution, just repeat the part of the circuit on the right, extending it out to as many bits as you might need. You may also be able to use a binary counter that has a up/down input (like the 74ls193 I think), and implement the circuit in fewer gates. Just repeat this same circuit for the forward/back part of the mouse, and presto chango, you have a mouse driven position sensing device. Adding a little clarity here, the RIGHT* input to the above circuit is just a up/down select. When it is hi, the circuit counts down, and when it is lo, the circuit counts up (may be backwards). It works because the quadrature output RIGHT* will always be hi on the falling edge of the LEFT* input, causing the EOR gate to flip the Q1 output to Q1*, which makes the counter count down. If the thing reverses direction, the RIGHT* input will now always be lo on the falling edge of LEFT*, causing the EOR to do nothing to the output pulse Q1, therefore makeing the counter count up. The two mouse buttons are just normally open switches that are shorted to ground when the button is pushed. These do not have internal pullup resistors, so you need to supply some. A good value I like to use is 1K to +5. The switches will then supply you with +5 when open, and ground when closed. Finally, make sure you use a good +5 supply for the mouse, as it has 4 comparators internally that generate the quadrature pulses from the led/photosensor pairs. I can't think of anything else that might help you, but if you have more questions you think I might be able to answer, mail me or call and ask! Drop me some Email and let me know what your project is about and how well the mouse works for you. Good luck! Greg Garner gmg@hcx.uucp path: ...!uunet!harris.cis.ksu.edu!hcx!gmg 501-442-4847