• 0
PrinceDamon

Nexys 3 and keyboard on USB HID

Question

Hi guys, Im a newbie in this fiels, just started to learn ISE and using nexys 3 board Spartan 6. Just to mention it's for school. What I did is that I created a state machine to recognize a code then wright OK. The state machine is simple but my problem is with the keyboard, the code that the state machine should recongnize should be entered from the keyboard, I read the documentation about keyboard and nexys 3, it says it uses PS/2 and keyboard send data and clock, but I didn't understand well about what I should do to the clock, can someone explain it to me or tell me somewhere I can find good doc to make it function.I tried to put the keyboard in USB HID port but it didn't even put on its lights, is this normal. (if you have any advices please don't esitate, I know Im missing lots of things and I need someone to push me)

(I attached my machine state code and a keyboard code I found on the internet, I didnt understand how it gets data from the key board and what it does exactly to the PS2_Clk)

contraites1.ucf

Detecteur_Sequence.txt

my state machine.txt

ps2_keyboard.txt

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • oh, im sorry it looks like i posted the same file twice( Detecteur_Sequence.txt my state machine.txt). here is my state machine attached. What this state machine does is to detect a sequence entered from the keyboard. The sequence is LLHK. I detect the keycode sent by the keyboard and if the sequence is right opendoor should be 1(like a signal to open the door if the owner enters the right code).

my state machine.txt

Share this post


Link to post
Share on other sites
  • 0

So here's what's normal: trying to build something only to have it not work the first (second, third, etc.) time.  The real trick is not getting it to work on the first time, but learning to figure out what's going wrong when it doesn't work.  How, for example, can you get the FPGA/keyboard to tell you what they are doing and how your logic isn't matching.

So, I notice in your code, that the result is all or nothing.  If you get all of the keys pressed, you get feedback, but not until then.  This is preventing you from knowing how close you are (or are not) getting.  You want to know about the intermediate steps: did the first key get pressed?  Did the second key get pressed?  Was there a scan code from the keyboard between the two keys, perhaps telling you that the first key was released?  You've got plenty of LED's, feel free to use them.  For example, set one LED when the first key is pressed, another when the second key is pressed, a third when the second key is pressed after the first key and so on.

Speaking of keys being released, I didn't find anything in your code to handle the key release event. 

Hope this helps,

Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now