Page 1 of 1

More keyboard trouble

Posted: Sun Apr 04, 2004 1:50 pm
by vbbrett
Hello all,
Help is needed in getting this code to work. I have tried for about a week at debugging. So, now it's your turn to play with it.
Whenever I type using this code (I've tried this on 3 different computers) it always comes out with 2 or 3 of the same letter. Striking the key VERY quickly produces 1 letter on the screen. Why is this happenning and how can I resolve this issue?

This is very messy. I now. Work with me please. Any pointers would be nice.

Brett

[attachment deleted by admin]

Re:More keyboard trouble

Posted: Sun Apr 04, 2004 11:54 pm
by Curufir

Code: Select all

if (intnumber = 0x51) { keyhandler(); }
if (intnumber = 0x50) { ticks++; }
Both of these evaluate to true, so you call the keyhandler() function every tick.

Side-Note: Your code style is very difficult to read. I'd seriously advise you to tidy it up before the source grows much further (Unless the formatting somehow got removed on posting).

Re:More keyboard trouble

Posted: Mon Apr 05, 2004 2:17 am
by Pype.Clicker
case 'a': kprintf("a", xpos, ypos); pdat=1; break;
case 'b': kprintf("b", xpos, ypos); pdat=1; break;
case 'c': kprintf("c", xpos, ypos); pdat=1; break;
case 'd': kprintf("d", xpos, ypos); pdat=1; break;
aargh! :O

Code: Select all

if (intnumber = 0x51) { keyhandler(); }
if (intnumber = 0x50) { ticks++; }
these should be 'intnumber == 0x51' ... typical mistake for someone who comes into C :) and for someone who wrote C code all the night :-p

I'm not sure a "if (...) call_sub_handler()" is the nicest way to deal with interrupts at all ...