- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
i am trying to make a PS/2 Keyboard work with my FPGA and C language. I tried to capture sequences from the keyboard by using the following code : while(1)
{
while(1)
{
if(*ps2Data!=1)
{
printf("%d", *ps2Data);
printf("%d", *ps2Data);
printf("%d", *ps2Data);
printf("%d", *ps2Data);
printf("\n");
break;
}
}
usleep(500000);
}
However the sequences that i had captured are not always the same for 1 key they can be the same for two different keys. For instance, when i pressed the 0 from the keypad it gave this (from the console) : 0001 0001 0101 0001 0001 0001 0001 And when i pressed the letter "N" i had : 0001 0101 0001 0001 0001 0001 0001 I know that there is a sequence when the key is pushed and an other one when the key is released, but i don't think that this is my problem. Actually i only need the 0-9 digits from the keypad which should be easier to implement (i guess). How could i do to capture the right sequences from the keyboard by using C ? Thank you for helping me :)
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What ps2Data is? Is it a pointer to the rx register of your ps2 serial port?
Why do you read it 4 times? And, what's the meaning of if(*ps2Data!=1) ? Usually you need to test a "rx ready" bit on rx status register in order to know if new data word is available.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page