Update: I suggest to use MJOY-16 interface for rotary encoders.
After doing some experiments with the rotary encoder directly connected across the keyboard switches, I found that the keyboard controller IC (an old Intel P8049AH in my case) cannot detect too narrow pulses. (I checked this by rotating the encoder fast and checking with Notepad to see the key output). If key ON pulses are less than 20 msec, the key press is ignored or unstable. I also found that the time between two key presses cannot be too short either: The OFF time between two ON pulses needs to be more than 20 msec as well. This means that the rotary switch outputs need to undergo some pulse width modification before they can drive the keyboard. As mentioned before, the keyboard switches do not have a common ground, and therefore are best driven by means of a relay or Opto-coupler. For repeated switching, relays are too noisy. In this case, Opto-couplers are preferred.
The drawing above shows the rotary switch action (slow and fast turning) and required keyboard switch action to maintain stable key recognition. When the rotary encoder is turned very fast, the buffer circuit in between maintains the speed that the keyboard controller still can follow.
Circuit for elevator trim rotary encoder to elevator trim keyboard strokes
In the above circuit, the D-flipflop (one-half of CMOS HEF4013
IC) determines which direction the rotary encoder turns. When
turning in one direction, HEF4013 Q output will be high
The HEF4538 IC is connected as two non-retriggerable one-shots.
The first one-shot has a twice longer time than the second. Both are triggered by the pulses of one of the switches of the rotary encoder. The first negative going pulse will produce a pulse at both Q outputs. The pulse time duration is equal to R*C as connected to the timing pins. The Q output pulse of the first one-shot lasts 0.07sec, that of the second 0.033sec. As long as the first one-shot output is high, neither one-shot can be re-triggered by additional pulses of the rotary encoder. Even if the encoder is turned very fast, the opto-coupler is driven with a pulse that is at least 0.033sec high and 0.032sec low. Since CMOS ICs cannot deliver a lot of current, I added an emitter follower to drive the Opto-coupler. BC548C (or BC547) is a standard small signal NPN transistor. (see http://www.semiconductors.philips.com/)
The circuit is not perfect, as there are occasionally false pulses from the other section while tuning one direction. Adding 1 nF (0.001uF) capacitors at the rotary switches may help somewhat. (I did not use them). For elevator trim, I found the performance satisfactory.
In principle, the same circuit can be used for rudder trim. Since rudder trim is normally not rotated very fast, some simplifications can be made: I deleted the trigger inhibit after initial ON pulse, thereby saving one IC. The rotation direction detect circuit can be made from the other half of the HEF4013 IC. The circuit is shown below.
1&2: rotary encoder switches output (quick turn clockwise)
3: First one-shot output (HEF4538 pin 6)
4: Second one-shot output (pin10) that drives the opto-coupler
As can be seen, the very fast turn will give 32msec output pulses that the keyboard still can follow.
(Although you loose some pulses from the original encoder output, the final pulse count is the most you can get via the keyboard, and works much better than w/o pulse shape buffer).
Elevator and rudder trim electronics