State Machine for the Spartan 3E Knob (Rotary Encoder)

The following code is a simple state machine that determines the direction that the knob on the Spartan 3E is turning and outputs a clock signal (Count) as it turns. A & B are the inputs from the encoders on the knob, RST & CLK are the reset and clock obviously. Count is the clock signal that goes two cycle for each click of the knob. Dir is the current direction of the knob, 0 for clockwise and 1 for counter-clockwise. Be sure to de-bounce the A & B inputs from the knob as they will have lots of noise and cause the state machine to be unstable.



Change Log

2/28/2011: I had loads of trouble implementing this recently on hardware and ended up rewriting it so that it is easier to implement and less troublesome.
11/9/2010: Added code for VHDL module.


3 thoughts on “State Machine for the Spartan 3E Knob (Rotary Encoder)

  1. Hello,
    This information for view the knob funtion is really interestig for me, but a need it in VHDL not in Verilog, could you say me what can I do that in VHDL Language, do you have something like this in VHDL,please?

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *