Spartan-3A/3AN Starter Kit Board User Guide www.xilinx.com 29UG334 (v1.0) May 28, 2007Rotary Push-Button SwitchRRotary Shaft EncoderIn principal, the rotary shaft encoder behaves much like a cam connected to the centralshaft. Rotating the shaft then operates two push-button switches, as shown in Figure 2-9.Depending on which way the shaft is rotated, one of the switches opens before the other.Likewise, as the rotation continues, one switch closes before the other. However, when theshaft is stationary, also called the detent position, both switches are closed.Closing a switch connects it to ground, generating a logic Low. When the switch is open, apull-up resistor within the FPGA pin pulls the signal to a logic High. The UCF constraintsin Figure 2-11 describe how to define the pull-up resistor.The FPGA circuitry to decode the ‘A’ and ‘B’ inputs is simple but must consider themechanical switching noise on the inputs, also called chatter. As shown in Figure 2-10, thechatter can falsely indicate extra rotation events or even indicate rotations in the oppositedirection!Figure 2-8: Push-Button Switches Require an Internal Pull-up Resistor in the FPGAInput PinUG230_c2_05_021206Rotary / Push ButtonROT_CENTER Signal3.3V FPGA I/O PinFigure 2-9: Basic Example of Rotary Shaft Encoder CircuitryGNDVccoVccoA=‘0’B=‘1’A pull-up resistor in each input pingenerates a ‘1’ for an open switch.See the UCF file for details onspecifying the pull-up resistor.FPGAUG230_c2_06_030606Rotary ShaftEncoder