Many computer input devices, particularly mice and trackballs, use pairs of optoelectronic devices to generate electrical signals indicative of the mice and trackball movement. These electrical signals are used to control cursor movements on a video display of a computer. Mice and trackballs typically include a housing enclosing the optoelectronic devices and supporting a rotatable ball. The ball is in contact with two coupling shafts extending perpendicularly to each other. As the ball rotates, it rotates either or both of the shafts depending upon the direction of rotation of the ball. A notched encoder wheel is mounted on each shaft between the paired optoelectronic devices, typically a light-emitting diode ("LED") and a photodetector. The encoder wheel allows varying amounts of light from the LED to reach the photodetector depending upon the position of a notch between the LED and the photodetector. As the ball is rotated by a user, the corresponding rotations of the encoder wheels modulate the light received by the photodetector from the LED, thereby providing respective signals indicative of movement of the mouse or trackball in two orthogonal directions.
As an encoder wheel rotates, the adjacent photodetector outputs an analog signal consisting of a series of pulses. This series of pulses is input to a microprocessor within the mouse. These pulses are used to determine the magnitude and direction of mouse travel using quadrature calculation or other known techniques.
Most microprocessors are generally able to sense only digital input signals, i.e., a "0" or a "1" input signal. When an input signal exceeds a threshold value particular to the microprocessor, the microprocessor interprets the incoming signal as a digital "1" input signal. Generally, this threshold value cannot be adjusted in the microprocessor, and because of variations in manufacturing or other components, the threshold value may be too high or low for a particular application. Therefore, to compensate, prior systems have used comparator circuits exhibiting hysteresis positioned between the output terminal of the photodetector and the input terminal of the microprocessor to convert the analog signal from the photodetector to an incoming digital signal. The hysteresis of the comparator circuit can be adjusted to provide a "1" input to the microprocessor when the output signal from the photodetector exceeds an adjusted threshold value.
Most mice or trackballs use at least two optoelectronic pairs, thus generally requiting at least two, typically four, comparators. These external comparator circuits are often costly. Additionally, the optoelectronic pairs vary in their output characteristics, and the threshold values of microprocessors vary. Therefore, the comparators in each mouse must be tuned to the particular optoelectronic pairs and microprocessor used in the mouse. This tuning is also costly.
One known method of avoiding the above variations in optoelectronic pairs and microprocessor threshold voltages eliminates the comparators and uses a method performed by the microprocessor to act as a comparator. The microprocessor pulses the LED to conserve power. During each pulse, the method samples the output from the photodetector. A sample taken at a particular time is used for quadrature calculation. The time at which this particular sample is taken is adjusted to provide signals for accurate quadrature calculation. The method continuously measures the time the photodetector takes to make the transition from a digital "0" to a "1" input signal, and thereby the response of the optoelectronic pair can be approximated.
Under the method, a time value is established which represents the maximum amount of time required for a photodetector output signal to reach the microprocessor's threshold value after the encoder wheel permits light from the LED to reach the photodetector. The method then counts up to a predetermined fraction of this worst case time value and determines whether a digital "1" value is interpreted by the microprocessor. If a digital "1" is not interpreted, the counter continues to count and samples are taken of the photodetector's output signal until a point in time when a digital "1" signal is detected. At this point in time, the time value is reset to the current time value on the counter. If the counter counts up the maximum time value without interpreting a digital "1" signal, the time value remains at its established maximum time value. In either case, the microprocessor thereafter counts for another period of time equal to the current time value (either the reset or maximum value) and then samples the photodetector's output for quadrature calculation.
This method suffers from several deficiencies. For example, this method is particularly sensitive to noise. If the method encounters an initial noise spike while resetting the time value, the method may thereafter provide a predominance of digital "0" samples of the photodetector output for quadrature calculation. Additionally, the method requires two loops during the method, i.e., a counter loop where the counter is incremented by one time interval, and a comparison loop where the current sample is compared to a "1" signal. As a result, a faster, and thus more expensive, microprocessor is required to perform this method.